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

[xsl] cumulative sum along linked list


Subject: [xsl] cumulative sum along linked list
From: "Steve Renshaw" <renshaw_steve@xxxxxxxxxxx>
Date: Thu, 11 Oct 2001 10:15:43 +0000

Here is my XML:

<items>
  <item id="1"><dependson>0</dependson><data>10</data>
  </item>
  <item id="2"><dependson>1</dependson><data>20</data></item>
  <item id="3"><dependson>2</dependson><data>30</data></item>
  <item id="4"><dependson>7</dependson><data>40</data></item>
  <item id="5"><dependson>1</dependson><data>50</data></item>
  <item id="6"><dependson>1</dependson><data>60</data></item>
  <item id="7"><dependson>6</dependson><data>70</data></item>
</items>

I need some type of recursive template that will run throught each <item> and form a cumulative sum on <data> tracing back through to other <item>'s following the <dependson> tag. I need output that looks something like this (not the stuff in parentheses

 Item Sum
   1   10  (=10)
   2   30  (=10+20)
   3   60  (=10+20+30)
   4  180  (=10+60+70+40)
   5   60  (=10+50)
   6   70  (=10+60)
   7  140  (=10+60+70

Anyone know how to approach this?

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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




Current Thread