This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: XSLT: SUM function or "+" operator usage problems to display subtotal/total
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: XSLT: SUM function or "+" operator usage problems to display subtotal/total
- From: Kay Michael <Michael dot Kay at icl dot com>
- Date: Fri, 27 Oct 2000 12:14:52 +0100
- Reply-To: xsl-list at mulberrytech dot com
> <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