[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: resetting a variable

Subject: RE: resetting a variable
From: "Martinez, Brian" <brian.martinez@xxxxxxxxxxx>
Date: Tue, 14 Oct 2003 11:03:03 -0600
xsl reset variable
> From: Aananth.S [mailto:aananth.solaiyappan@xxxxxxxxxx]
> Sent: Tuesday, October 14, 2003 10:05 AM
> Subject:  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.martinez@xxxxxxxxxxx |
| 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.