[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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. -- Regards, Mukul Gandhi
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|