From: Aananth.S [mailto:aananth(_dot_)solaiyappan(_at_)oracle(_dot_)com]
Sent: Tuesday, October 14, 2003 10:05 AM
Subject: [xsl] resetting a variable
Hi,
Is there a way i can reset the value of a variable ..
suppose i have
<xsl:variable name="hello" select="100"/>
<xsl:for-each select="//manyrows>
<!-- i need to set the variable to hello to the value of
manyrows/rowval -->
</xsl:for-each>
How do i accomplish this?
VFAQ. Once an XSLT variable is bound to a value, you can't change it. By
moving the variable element inside your for-each loop:
<xsl:for-each select="//manyrows">
<xsl:variable name="hello" select="manyrows/rowval"/>
<!-- etc. -->
</xsl:for-each>
you can then have a new value for $hello in each iteration. However, this
variable will only be in scope within the for-each loop and would cease to
exist once the loop has ended.
hth,
b.
| brian martinez
brian(_dot_)martinez(_at_)cendant(_dot_)com |
| lead gui programmer 303.357.3548 |
| cheap tickets, part of trip network fax 303.357.3380 |
| 6560 greenwood plaza blvd., suite 400 englewood, co 80111 |
| cendant travel distribution services http://www.cheaptickets.com/ |
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list