|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Problem with filtrate sum
j23 wrote:
<xsl:template match="root-element"> <table> <xsl:variable name="x"> <xsl:for-each select="Row[position()>=1]"> <d><xsl:value-of select="translate(Number,'.','')"/></d> </xsl:for-each> </xsl:variable> <td><xsl:value-of select="sum(exslt:node-set($x)/d) "/></td> </table> </xsl:template> </xsl:stylesheet> If it is just for one name then you can simply change the code that sets up the variable e.g. <xsl:variable name="x"> <xsl:for-each select="Row[position()>=1][Name = 'Joe']"> <d><xsl:value-of select="translate(Number,'.','')"/></d> </xsl:for-each> </xsl:variable> then you would simply compute the sum as before <xsl:value-of select="sum(exslt:node-set($x)/d)"/> If you want to compute the sum for several names then you need to store the name when you build your variable e.g. <xsl:variable name="x"> <xsl:for-each select="Row[position()>=1]"> <d> <name><xsl:value-of select="Name"/></name> <value><xsl:value-of select="translate(Number,'.','')"/></value> </d> </xsl:for-each> </xsl:variable> Now you can compute e.g. <xsl:value-of select="sum(exslt:node-set($x)/d[name = 'Joe']/value)"/> -- Martin Honnen http://msmvps.com/blogs/martin_honnen/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








