RE: XSLT: SUM function or "+" operator usage problems to display subtotal/total

Subject: RE: XSLT: SUM function or "+" operator usage problems to display subtotal/total
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Fri, 27 Oct 2000 12:14:52 +0100
>           <xsl:variable name="subtotal">
>                <xsl:value-of select="$subtotal+number(Price)">
>           </xsl:variable>

You have fundamentally misunderstood the way XLST variables work, I'm
afraid. XSLT is not a sequential programming language with assignment
statements, it is a functional language in which you must express the output
you want as a function of the input. Don't think about accumulating the
total as you go along, think about calculating it at the point it is needed,
using XPath expressions such as "sum(../item/price)".

Mike Kay 


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


Current Thread