This is a sample of my XML, it can possibly have thousands of rows of items in a range of categories.
<store>
<products type="computer">
<item desc="text" amount="99"></c>
<item desc="text" amount="69.95"></c>
<item desc="text" amount="4.50"></c>
<item desc="text" amount="10"></c>
<item desc="text" amount="9.99"></c>
<item desc="text" amount="24"></c>
</products>
<products type="books">
<item desc="text" amount="5"></c>
<item desc="text" amount="9.99"></c>
<item desc="text" amount="24"></c>
</products>
<products type="music">
<item desc="text" amount="5"></c>
<item desc="text" amount="1"></c>
<item desc="text" amount="4.50"></c>
<item desc="text" amount="10"></c>
<item desc="text" amount="9.99"></c>
</products>
</store>
What I want is some sort of loop that will allow me to create a header for every 100 items regardless of the product type. That s easy enough but in this header I want a sum of the amounts of just the 100 items directly under that header.
Currently I have tried to slpit the tree into groups of 100 so I can perform a sum function on every group. I have been a few days at this problem but I fail to produce a complete working solution.
My output should look something like this (if the n was 3):
Header Total=173.45
text,99
text,69.95
text,4.50
Header Total=43.99
text,10
text,9.99
text,24
Header Total=38.99
text,5
text,9.99
text,24
Header Total=10.50
text,5
text,1
text,4.50
Header Total=19.99
text,10
text,9.99