Re: [xsl] grouping and sum

Subject: Re: [xsl] grouping and sum
From: dmitrik@xxxxxxxxxxxxxx
Date: Mon, 6 Dec 2004 11:13:13 -0500 (GMT-05:00)
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: [xsl] 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