[xsl] Summing computed values

Subject: [xsl] Summing computed values
From: Lorenzo De Sio <l.desio@xxxxxx>
Date: Wed, 10 Jan 2001 16:46:04 +0100

Is anyone able to figure a way to sum computed values?

I am facing a quite classical problem:

given this XML:

		<desc>Article 70028</desc>
		<desc>Article 70010</desc>

I would like to calculate the total due :-)

While expressions such as

	<xsl:value-of select="sum(//cart/item/qty)"/>

	<xsl:value-of select="sum(//cart/item/price)"/>

obviously work as expected,

expressions such as

	<xsl:value-of select="sum(//cart/item/price * qty)"/>
	<xsl:value-of select="sum(//cart/item/price * //cart/item/qty)"/>

obviously don't work, since sum expects a node-list.

I've tried other approaches, such as using <xsl:param>, but I only got more
confused. Has anyone got any idea?



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

Current Thread