473,473 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XSLT Grouping and Sum

2 New Member
In XML ver 1.0.

Here is XML I have:

Expand|Select|Wrap|Line Numbers
  1. <CustRef>
  2. <Contract>
  3. <ContractId>1</ContractId>
  4. <SumItem>
  5. <SumItemResult>
  6. <AggSetSumItem>
  7. <Days>1</Days>
  8. <Service>TT</Service>
  9. </AggSetSumItem>
  10. <Charge>
  11. <Amount>40.00</Amount>
  12. </Charge>
  13. </SumItemResult>
  14. </SumItem>
  15. <ContractId>1</ContractId>
  16. <SumItem>
  17. <SumItemResult>
  18. <AggSetSumItem>
  19. <Days>1</Days>
  20. <Service>TE</Service>
  21. </AggSetSumItem>
  22. <Charge>
  23. <Amount>240.00</Amount>
  24. </Charge>
  25. </SumItemResult>
  26. </SumItem>
  27. <ContractId>1</ContractId>
  28. <SumItem>
  29. <SumItemResult>
  30. <AggSetSumItem>
  31. <Service>TT</Service>
  32. </AggSetSumItem>
  33. <Charge>
  34. <Amount>880.00</Amount>
  35. </Charge>
  36. </SumItemResult>
  37. </SumItem>
  38. </Contract>
  39. <Contract>
  40. <ContractId>2</ContractId>
  41. <SumItem>
  42. <SumItemResult>
  43. <AggSetSumItem>
  44. <Days>1</Days>
  45. <Service>TT</Service>
  46. </AggSetSumItem>
  47. <Charge>
  48. <Amount>0.50</Amount>
  49. </Charge>
  50. </SumItemResult>
  51. </SumItem>
  52. <ContractId>2</ContractId>
  53. <SumItem>
  54. <SumItemResult>
  55. <AggSetSumItem>
  56. <Days>1</Days>
  57. <Service>TT</Service>
  58. </AggSetSumItem>
  59. <Charge>
  60. <Amount>350.20</Amount>
  61. </Charge>
  62. </SumItemResult>
  63. </SumItem>
  64. <ContractId>2</ContractId>
  65. <SumItem>
  66. <SumItemResult>
  67. <AggSetSumItem>
  68. <Service>TZ</Service>
  69. </AggSetSumItem>
  70. <Charge>
  71. <Amount>880.00</Amount>
  72. </Charge>
  73. </SumItemResult>
  74. </SumItem>
  75. </Contract>
  76. </CustRef>
I want to group by <ContractId> and sum <Amount> where <Service> is 'TT' and <Days> is greater than 0. For example:

1 40
2 400

Using Muenchian method, I can sum the <Amount> for every <ContractId>, but am can't select only these <SumItem> for which <Service> is equal to 'TT' and <Days> is greater than 0.

Any help is appreciated.

10x in advance.

Plamen
Sep 14 '06 #1
0 1895

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Graham | last post by:
Hi, I am having trouble getting XSL to count the members of a group. What I am trying to do is group by <objectid.Contactid> and count the number of <activityid>'s for each <objectid.contactid>....
5
by: inquirydog | last post by:
Hi- Does anyone know a way to compare whether two nodes contain the same information in xslt (the name, attributes, and all content recursivly should be the same. I am interested in the case...
5
by: Jody Greening | last post by:
Transforming with XSLT, Grouping elements until difference found. I am seeking some help with the following problem, I am fairly new at XSLT transformations, and my problem may lie in looking at...
2
jkmyoung
by: jkmyoung | last post by:
Here's a short list of useful xslt general tricks that aren't taught at w3schools. Attribute Value Template Official W3C explanation and example This is when you want to put dynamic values...
1
by: Sandeep Singh | last post by:
Hi, How to do group by in XSLT ? I tried on the following codes: <files> <file name="swablr.eps" size="4313" project="mars"/> <file name="batboy.wks" size="424" ...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.