[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Calculating cumulative values

Subject: Re: Calculating cumulative values
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Sun, 4 Feb 2007 12:17:44 +0530
Re:  Calculating cumulative values
For sorting, I feel you need to modify Andrew's stylesheet as following:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="xml" indent="yes" />

<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>

</xsl:stylesheet>

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).


On 2/4/07, Simon Shutter <simon@xxxxxxxxxxx> wrote:
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.