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'
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.
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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--