[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
On 08/04/2014 20:13, henry human wrote:
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.
that defines $foo to be a document node with a sing;e text node child that is a sequence of 1s and 0s.
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?
Re: [xsl] update value of variable in for-each loop
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 |
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.
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>
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
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 |