xsl-list
[Top] [All Lists]

generating totals

2003-06-16 10:03:36
I have a rather large xml and I am trying to calculate some totals.  I have
to go through the whole file once listing the information for each client...
then after i have been though the file, I need to print the totals... If I
were using a different language, i would just keep up with the totals so far
in a variable.. but the only way I have come up with doing it in xsl is
going through the file, then at the end, doing a sum of the values i need to
add... This would be ok, but the file is so large, it takes a long time for
it to go through the file again.. Anyone have any suggestions?

XML Layout
<client>
<name />
<phone />
<price />
</client>

Pseudo-XSL (current)
<for-each client>
print name, phone, price
</for-each>
total = <value-of sum(//client/price)>

my xml file is a great deal more involved than I have listed, but I think my
example explains my situation correctly.

Pseudo-XSL (desired)
<for-each client>
print name, phone, price
<remember total so far???>
</for-each>
print total

Thanks for any help!!!


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