xsl-list
[Top] [All Lists]

Re: grouping and sum

2004-12-06 09:12:49
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_TTBlack), '###,###,##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_TTBlack>10</StepCharge_TTBlack>
                </Step>
                <Step>
                   <MinFlowDate>11/11/2005</MinFlowDate>
                   <StepCharge_TTBlack>10</StepCharge_TTBlack>
                </Step>
        </Trade>
<Portfilio>     

Thanks,
Dmitri

-----Original Message-----
From: David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk>
Sent: Dec 6, 2004 9:42 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>