Subject: Re: [xsl] update value of variable in for-each loop From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 08 Apr 2014 20:56:18 +0100 |
Hi I have a for-each loop inside for-each I try to test a variable:
That defines foo to be an empty string, butit doesn't matter what it defines it to be as you immediately discard this variable and over-write it with another one with the same name://if statement <xsl:if test="$foo = 1"> //do nothing
The varibale definition: <xsl:variable name="foo"/>
<xsl:variable name="foo"> <xsl:for-each select="data"> <xsl:choose> <xsl:when test="contains(elements/elementA '1234)">
<xsl:value-of select="1"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="0"/> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:variable>
Unfortunatelly the value of the varable foo is either 001 , 011,00011 and so one
I even defined the varable as a xs:integer type or as below , but ever the value is never a 1 or 0
<xsl:variable name="foo" select='1'"/> <xsl:variable name="foo"> <xsl:for-each select="data"> <xsl:choose> <xsl:when test="contains(elements/elementA, '1234)">
<xsl:value-of select="'1'"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="'0'"/> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:variable> Brg Henry
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] update value of variable, David Carlisle | Thread | Re: [xsl] XSLT Hello World - outrea, Ihe Onwuka |
Re: [xsl] update value of variable, Michael Kay | Date | Re: [xsl] Re: [xquery-talk] backtic, Wolfgang Laun |
Month |