Welcome to WebmasterWorld Guest from 54.146.246.4

Forum Moderators: httpwebwitch

Message Too Old, No Replies

XSLT Sum help

     

diablokicks

8:32 pm on Apr 1, 2010 (gmt 0)

5+ Year Member



I need help getting the sum of two attributes
EURO TOTAL: $
<xsl:for-each select="Books/Book/price[@currency='Euros']" >
<xsl:value-of select="."/>
<xsl:text>&#x0d;&#x0a;</xsl:text>
</xsl:for-each>
<xsl:for-each select="Books/Book" >
<xsl:value-of select="sum(/price[@currency='Euros'])"/>

</xsl:for-each>


I'm trying to sum the Euro's, but it is only showing 0's.
What am i missing?

httpwebwitch

6:18 am on Apr 3, 2010 (gmt 0)

WebmasterWorld Administrator httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member



the sum() syntax looks right, so it must be something wrong with the XPATH

try:
sum(price[@currency='Euros'])
without the "/" at the beginning