Subject: <xsl:import> / <xsl:include> Q From: mxmodi@xxxxxxxxxxxxxxx Date: Mon, 13 Nov 2000 11:03:25 -0600 |
Hi, I have a design Q on how to implement the <xsl:import>/<xsl:include> in my XSL. The situation is as following. I have 10 different XSL files (not necessarily in the same dir). All files use some common Javascript when rendered as HTML. I have written a XSL for the Javascript as follows: MainJS.xsl: <xsl:stylesheet version="1.0" xmlns:xsl ="http://www.w3.org/1999/XSL/Transform"> <xsl:variable name="config" select="document('config.xml')/MESSAGE/CONFIG" /> <xsl:template match="/"> <head> <script language="Javascript"><![CDATA[<!-- var fileserver = "]]><xsl:value-of select="$config" /><![CDATA["; ... several JS functions (common to all the XSL files...) ... I use the variable *fileserver* within my JS here. //--> ]]> </script> </head> </xsl:template> </xsl:stylesheet> Similarly, I have another JS.xsl with other functions common to only 3 of the 10 XSL files mentioned above. Now, here is an example of one of the XSL files that uses MainJS.xsl Test1.xsl <xsl:stylesheet version="1.0" xmlns:xsl ="http://www.w3.org/1999/XSL/Transform"> <xsl:include href="MainJS.xsl" /> <xsl:template match="/"> <html> <head> <script language="Javascript"><![CDATA[<!-- //reference to the same variable defined in MainJS.xsl var fileserver = "]]><xsl:value-of select="$config" /><![CDATA["; ...some customized additional JS only for this file...I use the variable *fileserver* within my JS here. ... //--> ]]> </script> </head> <body> more XSLT processing... </body> </html> </xsl:template> </xsl:stylesheet> Now, here is an example of one of the XSL files that uses both MainJS.xsl and JS.xsl Test2.xsl: <xsl:stylesheet version="1.0" xmlns:xsl ="http://www.w3.org/1999/XSL/Transform"> <xsl:include href="MainJS.xsl" /> <xsl:include href="JS.xsl" /> <xsl:template match="/"> <html> <head> <script language="Javascript"><![CDATA[<!-- //reference to the same variable defined in MainJS.xsl var fileserver = "]]><xsl:value-of select="$config" /><![CDATA["; ...some customized additional JS only for this file...I use the variable *fileserver* within my JS here. ... //--> ]]> </script> </head> <body> more XSLT processing... </body> </html> </xsl:template> </xsl:stylesheet> The problem I am having with this design is that the <xsl:include> does not work. Both MainJS.xsl and JS.xsl are in the same directory. What am I missing? ANy help is appreciated. Thanks, Maulik XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: SV: Change the value of a param, Jeni Tennison | Thread | Re: <xsl:import> / <xsl:include> Q, Jeni Tennison |
RE: What is XPath? Is this a W3C st, Fenton, Brigitte (Th | Date | Re: What is XPath? Is this a W3C st, edmund mitchell |
Month |