[xsl] update value of variable in for-each loop

Subject: [xsl] update value of variable in for-each loop
From: henry human <henry_human@xxxxxxxx>
Date: Tue, 8 Apr 2014 20:13:03 +0100 (BST)
Hi
I have a for-each loop
inside for-each I try to test a variable:
//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 and the if statement works never correct  !
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