Subject: Re: [xsl] Variable scope when using imported stylesheets From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 24 Aug 2004 16:48:42 -0400 |
<xsl:template match="list"> <xsl:variable name="linecount" select="count(child::line)"/> <xsl:text>
Line count: </xsl:text> <xsl:value-of select="$linecount"/> </xsl:template>
statement: x + y = 5 context: y = 4
Cheers, Wendell
It's not totally clear what your requirements are but I think that you are making the mistake (common for some reason) of thinking of variables as holding Xpath expressions, they don't; they hold _values_ (node sets in your case) so if you have a variable binding such as
<xsl:variable name="ImpVehData" select="FileRefEval/FileRefVehData" />
Then the value of $ImpVehData is whatever node set results in evaluating that xpath __at the point of the declaration__. In common with most programming languages, XSLT can not store an arbitrary expression in a variable that you may re-evaluate, getting different results in different contexts.
the smallest unit that you can re-evaluate in that way is a named template. Calling a named template will cause the body of the template to be evaluate in a context determined by the call.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Variable scope when using, Wendell Piez | Thread | [xsl] This is just to say ..., Joseph Dane |
Re: [xsl] apply template, Wendell Piez | Date | Re: [xsl] Variable scope when using, Wendell Piez |
Month |