Re: [xsl] xsl:variable inside xsl:for-each

Subject: Re: [xsl] xsl:variable inside xsl:for-each
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 12 Apr 2006 14:31:09 +0100
> Tthe values within the <t> tags will be displayed. I need the
> variables because changes to the values will be done only to the <ec>
> tags.

Sorry I have no idea what you mean by this. 9 times out of 10 when
people say they "need a variable" the final solution suggested on the
list doesn't use (or doesn't need to use) variables at all. The code
I suggested transformed from your posted input to your requested output.
Presumably you also want to transform the <t> element to something but you
haven't said what transform you want to do in that case. You need to
post your required result including the transform that you want applied
to <t>.

In your original post you said

> theoretically the xsl file should do this:
> <xsl:for-each select="ec">
> <!-- MAKE A VARIABLE NAMED X, Y, and Z -->
> </xsl:for-each>

But you didn't say what values you wanted $X $Y and $Z to have, or where
you wanted to use them. Note that variable declarations on XSL always
have scope the surrounding element so in this case if you have
xsl:variable inside xsl:for-each then the variables will go out of scope at
the </xsl:for-each> so you would need to use each variable in the same
iteration as it was defined.


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread