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

RE: sum function used for values within a node

Subject: RE: sum function used for values within a node
From: TSchutzerWeissmann@xxxxxxxxxxxxxxxx
Date: Mon, 7 Oct 2002 11:23:54 +0100
xsl sum function
Michael wrote:

> I am returning values back from a recordset and populating 
> nodes with the
> values. I am struggling to sum those values once they have all been
> returned. 
> 
> for example:
> 
> I am returning each value from completed_setup with a for-each loop. 
> 
> 
> <xsl:for each Record/Reseller_ID>
> 
> <xsl:value-of select="./CLI/COMPLETED_SETUP"/>
> 
> </xsl:end each>
--------^^^^^^^^  surely not?

so they're Record/Reseller_ID/CLI/COMPLETED_SETUP's? It always helps to show
your xml.


> Later on what I want to do is to sum all values held within the
> <completed_setup>node and write out in a seperate cell. 
> The code im currently using is :
> 
> <xsl:value-of select="sum(../CLI/COMPLETED_SETUP)"/>
> 
> wihich is outide the above loop. 

does that mean, outside the above loop but in the same context as the loop?
If you're having to do <xsl:for-each select="Record/Reseller_ID"> then your
context is the parent of Record. If in that context you then ask for
"../CLI/COMPLETED_SETUP" then from what little glimpse of your xml you've
given us you're probably getting an empty node-set, unless the parent of the
the parent of Record also have CLI/COMPLETED_SETUP children...

How about summing "Record/Reseller_ID/CLI/COMPLETED_SETUP" instead? But this
is all mere conjecture, without knowing the contexts :)
> 
> Also is it possible to create seperate tables within the 
> stylesheet that
> appear at after a recordset has been displayed. I have 
> displayed  values
> back from a recordset howver I wish to have a final total 
> table at the end
> of the report which is written back. currently I have put 
> this as a seperate
> table aoutise the loop which processes invididual customers 
> however this
> total table appear at the bottom of each report page - I just 
> want it at the
> end of the report. 

what does your xml look like?

cheers,
Tom 

 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.