xsl-list
[Top] [All Lists]

RE: simple summation question

2002-12-30 14:26:04
From: Lee, Insoo [mailto:Insoo(_dot_)Lee(_at_)gs(_dot_)com]
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(_dot_)martinez(_at_)trip(_dot_)com |
| 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



<Prev in Thread] Current Thread [Next in Thread>