[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: variable going out of scope in a for-each loop?
> <xsl:for-each select="cell"> > <xsl:if test="number(.)=number(.)"> > We have a number here > <xsl:choose> > <xsl:when test="position() mod 2 = 0"> > mod 2 = 0! > <xsl:variable name="aantal_uren"> > <xsl:value-of select="."/> > </xsl:variable> > The value of the aantal_uren is: <xsl:value-of > select="$aantal_uren"/>|| > The value of the uur_tarief is: <xsl:value-of > select="$uur_tarief"/>|| > </xsl:when> Oops, $aantal_uren is gone :( > <xsl:otherwise> > mod 2 != 0! > <xsl:variable name="uur_tarief"> > <xsl:value-of select="."/> > </xsl:variable> > The value of the aantal_uren is: <xsl:value-of > select="$aantal_uren"/>|| Here must be syntax error - unresolved variable reference. > Now, as soon as I loop form the first number containing cell to > the next, the > value defined in the previous-sibling seems to go out of scope viz. Moreover, a scope of local variable is its parent element boundaries, so when you declare variable within <xsl:when> element, you lose it after </xsl:when> end tag. > why? Perhaps because the processor you are using is trying to be xslt1.0 rec compliant :) --- Oleg Tkachenko, Multiconn International, Israel XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|