sum() when ...
hello,
I want to sum() all 'text' nodes in 'position' when the 'number' in 'position' is '1'.
the problem I have is that he summs all 'text' notes when there is only one <nr>1</nr>
my xslt:
<xsl:variable name="sum" select="sum(//../../../../../../text)"></xsl:variable>
<xsl:variable name="art" select="//../../../../../../nr"></xsl:variable>
<xsl:variable name="length10" select="..."></xsl:variable>
<xsl:choose>
<xsl:when test="$nr='1'">
<xsl:value-of select="concat(substring($null, 0,$length10),substring($betrag,1,10))"></xsl:value-of>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring($null, 1, 10)"/>
</xsl:otherwise>
</xsl:choose>
here the structure of my xml
<list>
<list2>
<data>
...
<send>
...
<senddata>
...
<positions>
<position>
<nr>1</nr>
<text>12345</text>
</position>
</positions>
<positions>
<position>
<nr>2</nr>
<text>54321</text>
</position>
</positions>
<positions>
<position>
<nr>1</nr>
<text>54321</text>
</position>
</positions>
...
...
thanks for helping!
|