This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
variable going out of scope in a for-each loop?
- From: Eric Smith <Eric dot Smith at fruitcom dot com>
- To: XSL List <xsl-list at lists dot mulberrytech dot com>
- Date: Sun, 9 Dec 2001 23:15:25 +0100
- Subject: [xsl] variable going out of scope in a for-each loop?
- Reply-to: xsl-list at lists dot mulberrytech dot com
xsl fragment:
<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>
<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"/>||
The value of the uur_tarief is: <xsl:value-of select="$uur_tarief"/>||
</xsl:otherwise>
</xsl:choose>
</xsl:if>
....
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.
We have a number here
mod 2 != 0!
The value of the aantal_uren is: ||
The value of the uur_tarief is:
246
||
<fo:table-cell ><fo:block font-size="8pt" text-align="center">
246
Here are the aantal
And the tarief
</fo:block></fo:table-cell>
We have a number here
mod 2 = 0!
The value of the aantal_uren is:
135
||
The value of the uur_tarief is: ||
<...
why?
--
Eric Smith - currently using xalan and xsltproc - what a difference speed makes - and fop on linux
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list