[xsl] summing up incrementally

Subject: [xsl] summing up incrementally
From: Paul Tremblay <phthenry@xxxxxxxxxxxxx>
Date: Thu, 18 Dec 2003 13:03:52 -0500
Is there a way to sum up incrementally?

My source tree looks something like this:

<root>

<year year = "1937">

  <month month = "January" percentage-increase = "105"/>
  <!--and so on for each month-->
  <month month = "December" percentage-increase = "103"/>
</year>

<year year = "1938">
  <month month = "January" percentage-increase = "104"/>
  <!--and so on for each month-->
  <month month = "December" percentage-increase = "102"/>
</year>


<year year = "1939">
  <month month = "January" percentage-increase = "106"/>
  <!--and so on for each month-->
  <month month = "December" percentage-increase = "108"/>
</year>

</root>

I need to sum up the percentage-increase just for December. I want my
resulting tree to look like this:

<root>

<year year = "1937" percentage-increase = "103"/>

<!--now add up Decmber 1937 and December 1938-->
<year year = "1938" percentage-increase = "105"/>


<!--now add up Decmber 1937, December 1938, and December 1939-->
<year year = "1938" percentage-increase = "113"/>

</root>

I'm thinking I can do with is a recursive template, but can't figure out
how.

Thanks

Paul

-- 

************************
*Paul Tremblay         *
*phthenry@xxxxxxxxxxxxx*
************************

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


Current Thread