This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

cumulative sum along linked list


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]