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

cumulative sum along linked list

Subject: cumulative sum along linked list
From: "Steve Renshaw" <renshaw_steve@xxxxxxxxxxx>
Date: Thu, 11 Oct 2001 10:15:43 +0000
linked list sum
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

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.