General discussion

Locked

reassigning and passing a variable as parameter in xsl

By kitty_ghai ·
I've the following structure of xml file
<FlightSegment>
<arrivalDate></arrivalDate>
<AirAvailabilityReply>
</FlightSegment>
<FlightSegment>
<arrivalDate></arrivalDate>
</FlightSegment>
<FlightSegment>
<arrivalDate></arrivalDate>
</FlightSegment>
</AirAvailabilityReply>
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
thanku

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| 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.

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums