[xsl] XSLT Processing Model Questions

Subject: [xsl] XSLT Processing Model Questions
From: "Dietrich Ayala" <dietrich@xxxxxxxxx>
Date: Fri, 12 Apr 2002 21:55:38 -0700
Hello,

I'm trying to grok the xstl processing model. Could someone help me out a bit? Using the document example in section D.1 of the XSLT
1.0 spec:

In this template, I'd thought that the source tree context node to be processed would be the root (/doc[1]), but then the match
expression wouldn't match it, because using /doc[1] as context means this match expression is looking at the immediate children of
the context node, right?

<xsl:template match="doc">
 <html>
   <head>
     <title>
       <xsl:value-of select="title"/>
     </title>
   </head>
   <body>
     <xsl:apply-templates/>
   </body>
 </html>
</xsl:template>

Now, in this template, the source tree context node is still the root (/doc[1]), right? So how does this match anything, as the
match expression seems like it would match any "doc" children of the context node?

<xsl:template match="doc/title">
  <h1>
    <xsl:apply-templates/>
  </h1>
</xsl:template>

I think I'll stop there. Because if my understanding of how the initial context node and source-tree-nodes-to-be-processed are
flawed, then it only goes downhill from here :)

Thanks,

Dietrich

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Anand
> Ganapathy
> Sent: Thursday, April 11, 2002 8:33 PM
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Query regarding XSL variables
>
>
> 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
>
>


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


Current Thread