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

RE: newbie - problem with sum

Subject: RE: newbie - problem with sum
From: "Andrew Welch" <andrew@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 18 Jan 2002 11:47:54 -0000
sum in access problem

So close... try this instead:

<xsl:variable name="sum" select="sum(/Report/Suspense/Amount[.>0])"/>

This will store/assign the sum of all values of the Amount element that are
greater than zero.  You can then access this number using $sum.  It works
like this:

sum() will sum all of the values of the nodes given to it

/Report/Suspense/Amount will match all Amount nodes that have a parent
Suspense that have a parent Report

[.>0] will filter the match to include only those nodes with values greater
than zero




-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Hesselberth,
Sent: Friday, January 18, 2002 11:06 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  newbie - problem with sum

I need to sum all the Amounts with a value > 0
I set up a variable

<xsl:variable name="suspensecr">
	<xsl:for-each select="/Report/Suspense">
		<xsl:if test="Amount &gt; 0"><xsl:value-of

which seems to contain all the required values but I can't get a sum
produced from this.
I've tried all sorts of <xsl:value-of select="sum(.... but to no avail.
Can someone help please?

The information contained in this e-mail and any files transmitted with it
is private and confidential. It is intended for the named addressee only.
If you are not the intended addressee you are prohibited from
storing, copying or using the information in any way.
If you received this e-mail due to a transmission error please notify the
sender immediately. No liability is accepted by Northern Rock
for any losses caused by viruses contracted during transit
over the Internet or present in any receiving system.
This e-mail is not intended to create legally binding commitments on
behalf of Northern Rock plc, nor do its contents reflect the corporate
views or policies of Northern Rock plc.

 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


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.
First Name
Last Name
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.