Subject: [xsl] Summing computed values From: Lorenzo De Sio <l.desio@xxxxxx> Date: Wed, 10 Jan 2001 16:46:04 +0100 |
Hi, Is anyone able to figure a way to sum computed values? I am facing a quite classical problem: given this XML: <cart> <item> <id>70028</id> <desc>Article 70028</desc> <price>4.8</price> <qty>5</qty> </item> <item> <id>70010</id> <desc>Article 70010</desc> <price>17.6</price> <qty>12</qty> </item> </cart> I would like to calculate the total due :-) While expressions such as <xsl:value-of select="sum(//cart/item/qty)"/> and <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? L. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Possible new key() function (Wa, Kay Michael | Thread | RE: [xsl] Summing computed values, Clapham, Paul |
Re: [xsl] Hyphenation in XSL FO, Sebastian Rahtz | Date | [xsl] alternative to msxsl:node-set, Paul Thomas |
Month |