[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Calculating cumulative values - another call for help


Subject: RE: [xsl] Calculating cumulative values - another call for help
From: "Simon Shutter" <simon@xxxxxxxxxxx>
Date: Wed, 29 Aug 2007 08:53:23 -0700

Andrew,

Thank you again.

Are the terms "micropipeline", "multiple passes" and "multiphase
transformation using temporary trees" all essentially equivalent?

Simon

-----Original Message-----
From: Andrew Welch [mailto:andrew.j.welch@xxxxxxxxx] 
Sent: August 29, 2007 1:40 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Calculating cumulative values - another call for help

On 8/29/07, Simon Shutter <simon@xxxxxxxxxxx> wrote:
> Dear Experts,
>
> I've been aggregating numbers in XSLT 1.0 using the 
> preceding-sibling:: axis for nodes with the same parent.  I now need 
> to aggregate all the values that precede the context node, even if 
> they have different parents.  For this I added another attribute using 
> the preceding:: axis (see XSLT 1.0 Stylesheet below).  Unfortunately, 
> the transform is starting to groan under the weight of all these 
> O(n^2) operations.  I have revisited an earlier solution suggested by 
> Dimitre Novatchev (see XSLT 2.0 Stylesheet below) that uses FXSL.  
> However, I'm not clear how I can adapt it to meet the new requirements.
Specifically, I would like to:
>
> a) generate attribute y3 that is a cumulative value based on all 
> preceding <point> elements
> b) copy y1 from the input to the output

- If you can use XSLT 2.0 then just do it in two passes
- If you are stuck with 1.0 without the node-set extension then you could
optimize it a little by processing <point> elements along the
following-sibling axis passing the running total as you go (but that would
require @x to have a limited number of possible values)
- If you are using 1.0 + node-set extension then again just do two passes to
avoid O(n^2)

cheers
andrew
--
http://andrewjwelch.com


Current Thread
Keywords