[xsl] generating totals

Subject: [xsl] generating totals
From: "Corey Wilson" <corey@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 16 Jun 2003 13:03:36 -0400
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
<name />
<phone />
<price />

Pseudo-XSL (current)
<for-each client>
print name, phone, price
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???>
print total

Thanks for any help!!!

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

Current Thread