RE: [xsl] Summing a Calculation

Subject: RE: [xsl] Summing a Calculation
From: bryan.s.schnabel@xxxxxxxxxxxxxx
Date: Thu, 21 Jun 2001 15:53:50 -0700
This works:

<xsl:template match="order">
      <xsl:text>Total Price: </xsl:text>
      <xsl:value-of select="sum(item/price)"/>

-----Original Message-----
From: Mark Swardstrom [mailto:mark@xxxxxxxxxx]
Sent: Thursday, June 21, 2001 11:55 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Summing a Calculation

I'm trying to get the sum of a purchase order, which seems simple, but I
can't find an easy solution.

Consider the following XML:


I was trying to do something along these lines:

<xsl:template match="order">
	<xsl:apply-templates select="item"/>
	<b>Total price: <xsl:value-of select="sum(item/price *

To get a total amount for the entire order.

But that gives the following error.  

	Can not convert #NUMBER to a NodeList!

Before I go down the (seemingly too complex) recursive loop approach, I was
wondering if anyone else had another idea.


- Mark

 XSL-List info and archive:

 XSL-List info and archive:

Current Thread