Web Development

General discussion


reassigning and passing a variable as parameter in xsl

By kitty_ghai ·
I've the following structure of xml file
i'm accessing all the flight segments using the for-each loop but i need to maintain the arrival date of the previous flightsegment.I 'm trying the following code
<xsl:variable name="arrive"><xsl:value-of select='substring-after(preceding-sibling::node[current()]/arrivalDate," ")'/></xsl:variable>
it works fine for the first attempt but keep on retaining the value of the variable.
if someone can help me on this..plz

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Can't reassign a variable's value in XSLT

by kcollins In reply to reassigning and passing ...

I know it seems crazy, but once you have assigned a value to a variable in XSLT, you cannot reassign it to a new value! Maybe they should have called it <xsl:constant> instead.

My suggestion would be to get rid of the variable and just use the <xsl:value-of> statement in every place that you need that value.

Related Discussions

Related Forums