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

Re: Grouping by key

Subject: Re: [xsl] Grouping by key
From: gopinath.emmidisetty@xxxxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 12 Nov 2004 13:05:08 +0000
Re:  Grouping by key
Hi,

Geert wrote:
>>Are you trying to display the sum of all colno 3 elements? try 
'sum(//*[@colno=3])' instead.
>>
>>If you want the cumulative of the 'above', you could try '*[@colno = 3] 
+ sum(preceding-sibling::account/*[@colno=3])'..

Thanks Geert.  Your suggestions work but what I want to do is sum up that 
column values matching the key.  Like when I am grouping the documents by 
Town, I want to sum up the 3rd column for that town.  Please check my xml 
document format and required output format.

Asssuming my xml document is 

<documents>
<account>
<accountnumber colno="0">0001</accountnumber>
<companyname colno="1">ABC Ltd</companyname>
<town colno="2">Ford</town>
<ordervalue colno="3">115.49</ordervalue>
<postcode colno="4">FD13QG</postcode>
</account>
<account>
<accountnumber colno="0">0002</accountnumber>
<companyname colno="1">XYZ Ltd</companyname>
<town colno="2">Ford</town>
<ordervalue colno="3">120.49</ordervalue>
<postcode colno="4">XY13QG</postcode>
</account>
<account>
<accountnumber colno="0">0003</accountnumber>
<companyname colno="1">HAM Ltd</companyname>
<town colno="2">Hamtown</town>
<ordervalue colno="3">110.34</ordervalue>
<postcode colno="4">HA13QG</postcode>
</account>
</documents>

I want an output like

Ford                            235.98 
        0001    ABC Ltd 115.49  FD13QG
        0002    XYZ Ltd         120.49  XY13QG

Hamtown                 110.34
        0003    HAM Ltd 110.34  HA13QG

Thanks.

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.