xsl-list
[Top] [All Lists]

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

2002-12-04 08:53:03
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



<Prev in Thread] Current Thread [Next in Thread>