[Home] [By Thread] [By Date] [Recent Entries]
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
|

Cart



