|
Subject: Re: [xsl] Grouping by key From: gopinath.emmidisetty@xxxxxxxxxxxxxxxxxxxxxxxxx Date: Fri, 12 Nov 2004 13:05:08 +0000 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Grouping by key, Geert Josten | Thread | Re: [xsl] Grouping by key, Geert Josten |
| Re: [xsl] characters in xsl, David Carlisle | Date | Re: [xsl] Grouping by key, Geert Josten |
| Month |