I\'m working on an old site that uses java and xsl. How can I inculde a script file in an xsl file? Top of the file:
EDITED
Here is a solution that works
Assuming this is your xsl and you are including xsl as you mentioned. In this case I called it include.xsl
. I just call a template called headers that pipes out the javascript reference.
Main XSLT File:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:include href="include.xsl"/>
<xsl:template match="/">
<xsl:call-template name="headers"/>
<bar>
<xsl:value-of select="root"/>
</bar>
</xsl:template>
</xsl:stylesheet>
include.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template name="headers">
<script src="/fs/scripts/shipment/shipment.js"></script>
</xsl:template>
</xsl:stylesheet>
Output:
<?xml version="1.0" encoding="utf-8"?>
<script src="/fs/scripts/shipment/shipment.js"/>
<bar>foo</bar>