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

RE: a*b, sum(c*d), sorted on <sort>

Subject: RE: a*b, sum(c*d), sorted on <sort>
From: "Andrew Welch" <awelch@xxxxxxxxxxxxxxx>
Date: Wed, 4 Dec 2002 16:30:18 -0000
download sumcd
I would use a use a temporay tree containing a sorted list of <item>
with the first part of the calculations complete, so you would have
something like:

<root>
  <item><a*b>20</a*b><sumCD>18</sumCD></item>
  <item><a*b>6</a*b><sumCD>40</sumCD></item>
  ....

Then produce your table by applying-templates to the temporary tree,
using sum() on the <sumCD> element to get the cumulative column.  

cheers
andrew 


> Here is my XML:
> 
> <root>
>  <item><a>1</a><b>2</b><c>2</c><d>7</d><sort>3</sort></item>
>  <item><a>2</a><b>3</b><c>5</c><d>8</d><sort>2</sort></item>
>  <item><a>3</a><b>4</b><c>1</c><d>2</d><sort>4</sort></item>
>  <item><a>4</a><b>5</b><c>2</c><d>9</d><sort>1</sort></item>
> </root>
> 
> For each <item> I need to produce a row containing
> cells for a*b and cumulative c*d where the items
> are taken sorted on <sort>:
> 
>  +-----+----------+
>  | a*b | sum(c*d) |
>  +-----+----------+
>  |  20 |    18    |
>  +-----+----------+
>  |   6 |    58    |
>  +-----+----------+
>  |   2 |    72    |
>  +-----+----------+
>  |  12 |    74    |
>  +-----+----------+
> 
> The above a gross simplification, but I would like to get input from
> people on how they would structure the problem as it has a lot
> more detail in reality. In a nutshell, I have both recursive and 
> non-recursive calculations to perform in each row.
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 
> 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.