[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

<xsl:import> / <xsl:include> Q

Subject: <xsl:import> / <xsl:include> Q
From: mxmodi@xxxxxxxxxxxxxxx
Date: Mon, 13 Nov 2000 11:03:25 -0600
js xsl
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.