|
Subject: Re: [xsl] Calculating cumulative values From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Sun, 4 Feb 2007 12:17:44 +0530 |
<xsl:template match="root">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates select="set">
<xsl:sort select="@id" data-type="number" />
</xsl:apply-templates>
</xsl:copy>
</xsl:template><xsl:template match="set">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:apply-templates select="point">
<xsl:sort select="@x" data-type="number" />
<xsl:sort select="@y1" data-type="number" />
</xsl:apply-templates>
</xsl:copy>
</xsl:template><xsl:template match="point">
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:attribute name="y2">
<xsl:value-of select="sum(preceding-sibling::point[@x =
current()/@x]/@y1 | @y1)" />
</xsl:attribute>
</xsl:copy>
</xsl:template>Although this appears to be the right approach to me (for sorting), I feel this won't work, because preceding-sibling:: axis reads nodes in reverse document order (which is static), and does not read nodes from the sorted sequence (which is what I think you want).
I think I may go with 'conventional' solution provided by Andrew, because it is natively supported by .Net 2 and my data sets are relatively small and tranformed pretty quickly. I will look more into FXSL for the longer term.
If I needed to sort the data before I determined the cumulative numbers, how do I ensure this happens before aggregating the data?
Thanks,
Simon
-- Regards, Mukul Gandhi
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Calculating cumulative va, Simon Shutter | Thread | Re: [xsl] Calculating cumulative va, Dimitre Novatchev |
| RE: [xsl] Calculating cumulative va, Simon Shutter | Date | RE: [xsl] Calculating cumulative va, Michael Kay |
| Month |