On 08/04/2014 20:13, henry human wrote:
Hi
I have a for-each loop
inside for-each I try to test a variable:
Sorry, I can't work out what your question is. Your code fragments below
dont't have an xsl:if aand you gove no indication what you intend then
to produce. (It is very hard to guess as they are so convoluted.
//if statement
<xsl:if test="$foo = 1">
//do nothing
The varibale definition:
<xsl:variable name="foo"/>
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:
<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>
that defines $foo to be a document node with a sing;e text node child
that is a sequence of 1s and 0s.
Unfortunatelly the value of the varable foo is either 001 , 011,00011 and so one
That is what I'd expect, but yu don't say what you want it to be.
and the if statement works never correct !
There is no if?
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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--