xsl-list
[Top] [All Lists]

RE: summing up incrementally

2003-12-19 07:10:57

WOOPS! 

Of course, 103 + 102 + 108 = 313! 

Okay, I need to minus the 100:

1938 = 03 + 02 = 05

1939 = 03 + 02 + 08 = 13


Your maths is not your strong point - have you never heard of compound
interest? You actually need the product 1.03 * 1.02 * 1.08.

The way to get that in XSLT is a recursive template. Pass the list of
values and the starting value (1) as a parameter, the template then
multiplies the supplied value (1) with the first value in the list
(1.03) and passes this as a parameter in a recursive call to process the
remaining items in the list.

Michael Kay


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