RE: [xsl] simple summation question

Subject: RE: [xsl] simple summation question
From: "Martinez, Brian" <brian.martinez@xxxxxxxx>
Date: Mon, 30 Dec 2002 14:26:04 -0700
> From: Lee, Insoo [mailto:Insoo.Lee@xxxxxx]
> Sent: Monday, December 30, 2002 2:12 PM
> Subject: [xsl] simple summation question
> 
>   Hello - a quick simple question, how would get a subTotal 
> for someValue by
> entity as shown below?
>   I can get a grand total by using sum(/report/entity/row/someValue)..
> 
>   Thanks
> 

The simplest way would be "sum(/report/entity[n]/row/someValue)", where n is
the position of the selected entity element in document order.  If you
wanted to output each subtotal you could do

<xsl:for-each select="/report/entity">
  <xsl:value-of select="sum(row/someValue)"/>
</xsl:for-each>

xsl:apply-templates could also be used in a similar fashion.

hth,
b.

| brian martinez                              brian.martinez@xxxxxxxx |
| senior gui programmer                                  303.708.7248 |
| trip network, inc.                                 fax 303.790.9350 |
| 6436 s. racine cir.                             englewood, co 80111 |
| http://www.cheaptickets.com/                   http://www.trip.com/ |

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


Current Thread