[xsl] Query regarding XSL variables

Subject: [xsl] Query regarding XSL variables
From: "Anand Ganapathy" <Anand.Ganapathy@xxxxxx>
Date: Fri, 12 Apr 2002 09:03:00 +0530
Hello,

I am generating an html file from an XML using XSL in order to generate a tree display .

I want to pass xsl:variables to a javascript function.How is it possible to achieve the same?

This is  an example of the scenario I am talking about so that what I intend to do becomes clear:

  <xsl:variable name = "nodeaddr1">
      <xsl:value-of select = "(//Node1/Nodeaddress) "/> 
 </xsl:variable>

<xsl:variable name = "lidentifier1">
      <xsl:value-of select = "(//Node1/Levelidentifier) "/>
</xsl:variable>

<xsl:variable name = "nodename1">
      <xsl:value-of select = "(//Node1/Nodename) "/>
</xsl:variable>
<TR class="DARK">
               <TD>
               <A class="hier" href="javascript:">
                  <img src="images\treePics\downarrow.gif" border="0" />  
	       </A> &#160;
	       <A href="javascript:" onClick="( var1,var2,var2);"> <xsl:value-of select="Nodename"/> </A>
            </TD>
    </TR>

I want var1,var2 and var3 being passed as the xsl variables declared above.
I  tried passing $nodeaddr1,$lidentifier1 and $nodename1 but those are unrecognized in the html.

Also tried passing them as:
<A href="javascript:" onClick="selectNode( <xsl:value-of select = "(//Node1/Nodeaddress)"/>, <xsl:value-of select = "(//Node1/Levelidentifier)) "/>, <xsl:value-of select = "(//Node1/Nodename) "/>);"></A>

But I get the following error:
Message: Server caught unhandled exception from servlet [jsp11]: javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: The value of attribute "onClick" must not contain the '<' character.

Please help.

Thanks in Advance,

Anand.




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


Current Thread