[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] JavaScript and XSL (ver2)


Subject: [xsl] JavaScript and XSL (ver2)
From: "Karl J. Stubsjoen" <karl@xxxxxxxxxxxxx>
Date: Thu, 19 Feb 2004 00:11:40 -0700

Hello,
Ohh man, I just made life very difficult.  However, there will be much
benefit and writing Javascript functions dynamically from XSLT.  Think this
topic warants a huge tutorial on it / or faq (hmm.. checking xsl faqs now)

All right, here is what I am trying to do (there are a lot of jscript
"Alert('test');" type calls... just to insure that things are operating as
expected (javascript does fire at these locations).
Here is what I have, well first what I am trying to accomplish is loading up
a xml dom object with some XML.  Executing dom.loadXML in javascript.  So, I
am expecting to build the XML dynamically in XSL, then issue the loadxml
into the client side xml active x object.
Seems easy enough.  Here is where I am at.. but not working:

        <script language="JavaScript" type="text/javascript">
        <xsl:text disable-output-escaping="yes">
         alert('test');
   </xsl:text>
  <xsl:call-template name="jscript_test"/>
        </script>


<xsl:template name="jscript_test">
 <xsl:variable name="test2">
     <xsl:element name="TEST">
         <xsl:element name="T"><xsl:attribute
name="att">1</xsl:attribute></xsl:element>
         <xsl:element name="T"><xsl:attribute
name="att">2</xsl:attribute></xsl:element>
         <xsl:element name="T"><xsl:attribute
name="att">3</xsl:attribute>the zoo</xsl:element>
        </xsl:element>
    </xsl:variable>

   <xsl:text disable-output-escaping="yes">alert('</xsl:text>
    <xsl:value-of disable-output-escaping="yes" select="$test2"/>
   <xsl:text disable-output-escaping="yes">');</xsl:text>

    <xsl:text disable-output-escaping="yes">dom.loadXML('</xsl:text>
     <xsl:value-of disable-output-escaping="yes" select="$test2"/>
 <xsl:text disable-output-escaping="yes">');</xsl:text>

    <xsl:text
disable-output-escaping="no">writeToLayer('select_signature',dom.xml);</xsl:
text>
</xsl:template>


The writeToLayer function above is a proven and stable function.
What I am expecting to happen, the the XML document "test2" gets loaded into
the dom object... and then I will simple display results of xml doc in the
DIV with id of "select_signature".  I am getting nothing at all.

Karl


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



Current Thread
Keywords