[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: [XSL] Grouping and Sum problem - XSL 1.0
Mike Finch [Wasabeat] schrieb:
Yes, im trying to do an xsl:copy-of for the results but I cannot get the sum's to add up when grouping the rows. Im trying to sum the grouped row's <royalty> <mechanicals> <taxes> <expenses> elements however I can only get the sums to add up for the first following sibling. I need to add sums for all following siblings which have the same <releaseid> and <order> as the row with they type='RELEASE'
Below is the XSL properly indented. Sorry about that.
Anyway, try this: <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- Requirement: Im having problems getting the sum for the royalty, mechanicals, taxes and expenses elements of my grouping to sum correctly. [...] I need to add sums for all following siblings which have the same <releaseid> and <order> as the row with the type='RELEASE'. --> <xsl:output indent="yes"/> <xsl:template match="row[ type = 'RELEASE' ]"> <xsl:copy> <xsl:apply-templates/> <royalty-sum> <xsl:value-of select=" sum( following-sibling::row[ releaseid = current()/releaseid and order = current()/order ]/royalty )"/> </royalty-sum> </xsl:copy> </xsl:template> <xsl:template match="@*|node()"><!-- identity template --> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:transform> Michael Ludwig
|
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
|