homepage Welcome to WebmasterWorld Guest from 54.166.148.189
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
XSLT Sum help
diablokicks




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

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




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

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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved