I am trying to write XSL (1.0) to recursively add values from nodes. I have googled and it seems there are functions to add as long as the nodes are parent/child. My nodes are quite a few steps beyond that. For example, I have:
<Document>
<Finance>
<Account>
<Type>Expense</Expense>
<Amount>25</Amount>
</Account>
</Finance
</Document>
<Document>
<Finance>
<Account>
<Type>Capital</Type>
<Amount>75</Amount>
</Account>
</Finance
</Document>
<Document>
<Finance>
<Account>
<Type>Expense</Type>
<Amount>50</Amount>
</Account>
</Finance
</Document>
I need to get a variable or something that totals 150 by adding all of these amounts. Note. This is not the exact structure but I simplified it. The nodes are the same for each document. I have been looking for a way of basically doing: i=0 then looping to add up with i=i+1
It seems like this is something that should be easy.
I even thought of maybe being able to for-each and creating a table that just has two columns then using that to add up but I cannot find a way. So I am looking for Account Type and the total running amount: Expense = 75 Capital = 75