I have the below xml
Something like this (I have re-constructing your code, as it was missing quite a lot):
This XSLT transformation:
when applied on the originally provided XML document:
produces the wanted result):
Sen 17 1 16 Dong 41 37 4 Mei 61 61 0
Do note the following:
The summation of the values of the @Pass
or the @Fail
attribute for the elements that belong only to the current group (the use of the key()
function).
The use of the
instruction to sort by the required sums.
The use of a global parameter named pSortBy
, which contains the name of the attribute on the sums of which to sort.
The use of the XSLT function current()