Subject: Re: [xsl] [XSL] Grouping and Sum problem - XSL 1.0 From: Michael Ludwig <mlu@xxxxxxxxxxxxx> Date: Wed, 30 Apr 2008 13:37:06 +0200 |
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'
Okay, and I'm guessing that you only want to do this for row[type = 'RELEASE'].
Below is the XSL properly indented. Sorry about that.
Indentation wasn't the main point. It's just that minimal examples, stripped of everything that is not essential to the problem, are a lot easier to grasp.
<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>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] [XSL] Grouping and Sum pr, Mike Finch [Wasabeat | Thread | [xsl] Cannot get sum past first sib, Mike Finch [Wasabeat |
Re: [xsl] Problem with Safari?, Manfred Staudinger | Date | Re: [xsl] xsltproc/LibXSLT - non-co, Michael Ludwig |
Month |