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

Re: grouping and sum

Subject: Re: grouping and sum
From: dmitrik@xxxxxxxxxxxxxx
Date: Mon, 6 Dec 2004 11:13:13 -0500 (GMT-05:00)
xsl group by sum
Is it possible to group the whole xml document by the Customers node without hardcoding a specific customer?
and at the same time also use the following date comparison. This code below is inside a for loop which 
lists every <Trade> , so no grouping is introduced.  One section of the xml is listed, but there can be
many Customers and Trade nodes



<xsl:value-of select="format-number(sum(Trade/Step
   [concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))>=
concat(substring($global,7)+3,substring($global,1,2),substring($global,4,2))]

   [concat(substring(MinFlowDate,7),substring(MinFlowDate,1,2),substring(MinFlowDate,4,2))<
concat(substring($global,7)+6,substring($global,1,2),substring($global,4,2))]
   /StepCharge), '###,###,##0')"/>

</b></td>

structure of xml

<Portfilio>	
<AsOf>11/30/2004</AsOf>
	<Trade>
		<TradeId>ED.TEST</TradeId>	
		<Customer>AAA</Customer>
		<Step>		   	 	   
		   <MinFlowDate>11/30/2004</MinFlowDate>		  
		   <StepCharge>10</StepCharge>
		</Step>
		<Step>
		   <MinFlowDate>11/11/2005</MinFlowDate>
		   <StepCharge>10</StepCharge>
		</Step>
	</Trade>
<Portfilio>	

Thanks,
Dmitri

-----Original Message-----
From: David Carlisle <davidc@xxxxxxxxx>
Sent: Dec 6, 2004 9:42 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  grouping and sum


> how is it possible to group by the Customer Node to retrieve a sum from StepCharge?

the sum of all StepCharge for customer AAA is


<xsl:value-of select="sum(Trade[Customer='AAA']/StepCharge)"/>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.