devxlogo

Grouping and Summing the Values in XML Using XSLT

Grouping and Summing the Values in XML Using XSLT

In this column, I have grouped the XML based on the GroupID element by using the generate-id() function. This generates unique keys used for indexing the key value. The key value is GroupID.

All the PV values of each groupID is then added and the sum is formatted till six decimal values.Here’s the XSLT file:

			

Now, input the XML file:

244133L244133L_EUR_STUB-11121619.203325866L325866L_EUR_STUB-12121619.2938325867L325867L_EUR_STUB-14121619.293864502722L502722L_EUR_STUB-13121543.293643502722L502722L_PLN_STUB-11234329.698236325866L506593L_EUR_STUB-11134543.12963244133L542056L_EUR_STUB-12342342.769823325867L553257L_PLN_STUB-98745908.128361570079L570079L-64325623.693286570079L570084L_EUR_STUB-67824233.986723244133L570090L-56721463.972345325866L570096L-87623763.23442325867L570098L-79843267.4232244133L570099L-87246234.23423325866L570106L-32423896.4732

devx-admin

Share the Post: