Altova Mailing List Archives

[xsl] generating totals

From: "Corey Wilson" <corey@---------------------->
Date: 6/16/2003 8:53:00 AM
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:


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.