Please help, I know that this isn't challenging or interesting like other posts, but I ve been stuck on it for days!!!
I ve been trying this in several ways but to no avail.
I have the following:
[...]
<finance>
<incomes>
<account name="X" value="-84" />
<account name="Y" value="12" />
<account name="Z" value="-98" />
<account name="S" value="-10" />
</incomes>
<costs>
<account name="A" value="7" />
</costs>
</finance>
how do I sum together the positive "value" values of <incomes> with the positive of <costs> and vice versa the negative value with the negative?
have tried
<xsl:variable name="sumOfIncomes">
<xsl:value-of select="sum(//incomes/account[@value][@value > 0])" />
</xsl:variable>
and something like using a recursive sum with
<xsl:value-of select="sum(//incomes/account[$position]/@value[(//incomes/account[$position]/@value > 0])" />
Thanks a million in advance
Regards
Azh
I ve been trying this in several ways but to no avail.
I have the following:
[...]
<finance>
<incomes>
<account name="X" value="-84" />
<account name="Y" value="12" />
<account name="Z" value="-98" />
<account name="S" value="-10" />
</incomes>
<costs>
<account name="A" value="7" />
</costs>
</finance>
how do I sum together the positive "value" values of <incomes> with the positive of <costs> and vice versa the negative value with the negative?
have tried
<xsl:variable name="sumOfIncomes">
<xsl:value-of select="sum(//incomes/account[@value][@value > 0])" />
</xsl:variable>
and something like using a recursive sum with
<xsl:value-of select="sum(//incomes/account[$position]/@value[(//incomes/account[$position]/@value > 0])" />
Thanks a million in advance
Regards
Azh