[xsl] Using Transforms and #include file

Subject: [xsl] Using Transforms and #include file
From: "Hellstern, Manny" <manny.hellstern@xxxxxxxxxxxxxx>
Date: Tue, 13 Nov 2001 09:57:22 -0600
I have a default.asp page on a web site that has the following:

	<script ID="clientEventHandlersJS" LANGUAGE="javascript">
		<!--#include file="JScripts/Buttons.js"-->
		<!--#include file="JScripts/Tabs.js"-->
		<!--#include file="JScripts/Functions.js"-->
	</script>

I am driving the content of this page by writing to ".innerHTML" of various
tags on the page using XML/XSL.  What I'd like to do is have my javascript
included with the appropriate output instead of everything loading
automatically when the default page loads.

Is it possible to have something like the following output from XSL so that
the actual script gets inserted?  I was trying to avoid actually putting all
of my script into the XSL file.

XSL snippet
     <div>
	<xsl:attribute name="Id">
	  <xsl:value-of select="JSSource" />
	</xsl:attribute>
	<script>
              <xsl:attribute name="Id">
	    <xsl:value-of select="clientEventHandlersJS" />
	  </xsl:attribute>
	  <xsl:attribute name="Language">
	    <xsl:value-of select="javascript" />
	  </xsl:attribute>
	  <xsl:copy-of select="document(<!--#include
file="JScripts/Buttons.js"-->)" / >
	</script>
    </div>

HTML output
   <div Id="JSSource">
   <script Id="clientEventHandlersJS" Language="javascript">
       function f1()
       {
           ....
       }
       function f2()
       {
           ....
       }
   </script>
   </div>

Thanks in advance.

Manny Hellstern

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread