[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: sum() command

Subject: Re: sum() command
From: "KUMAR NINGASHETTY" <KNINGASHETTY@xxxxxxxxxxxxxxxx>
Date: Tue, 20 Aug 2002 14:50:26 -0400
sum row
There is some syntax error there ...
for valor element ..use  <xsl:value-of select="sum(query/row/value[@field='valor'])"/>

For duracao element its in a different format and hence fails..Filter the data using string manipulation funcs depending 
on what kinda result you need .

- kumar

>>> vitor_cavalcanti@xxxxxxxxx 08/20/02 01:42PM >>>
Folks,

I got an error when i use the sum() command. Can you help me, guys? :)

I have following XML-structure:

<query>
    <row>
        <value field="data">25/07/2002</value>
        <value field="hora">15:54:40</value>
        <value field="grupo">2ª A 6ª</value>
        <value field="tipo">Voz</value>
        <value field="duracao">00:15:00</value>
        <value field="valor">80.04</value>
    </row>
    <row>
        <value field="data">25/07/2002</value>
        <value field="hora">15:45:30</value>
        <value field="grupo">2ª A 6ª</value>
        <value field="tipo">Voz</value>
        <value field="duracao">00:10:00</value>
        <value field="valor">0.05</value>
    </row>
    <row>
        ....
    </row>
</query>

I'm doing a <xsl:for-each select="value"> and puting all these values in a
<table> html. Now I wanna put the last line with a <td> with the total sum
of the "duracao" field and another <td> with the "valor" sum. Out of
for-each, I'm doing the following: <xsl:value-of
select="sum(/query/row[value/@field='duracao'])"/> and <xsl:value-of
select="sum(/query/row[value/@field='valor'])"/>. Both are returning NaN.

Any idea, guys?

Thanks,
Vitor

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



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.