I'm looking for an XSL to sort and group an XML by a node and sum by another node. I will have to use XSLT 1.0.
Here is my XML.
After sorting I need to have a new XML sorted and Grouped by <TransCode>
, and all <TransAmt>
should be summed for each group. I'm looking for the XSL for this task. Any help is appreciated. After sorting new XML should have only three nodes sorted in ascending order of <TransCode>
. All the <TransAmt>
must be added together.
Here is my XML:
<Transactions>
<Transaction>
<TransCode>0008</TransCode>
<TransType>Purchase</TransType>
<TransAmt>12.30</TransAmt>
</Transaction>
<Transaction>
<TransCode>0002</TransCode>
<TransType>Cash</TransType>
<TransAmt>26.00</TransAmt>
</Transaction>
<Transaction>
<TransCode>0008</TransCode>
<TransType>Purchase</TransType>
<TransAmt>25.00</TransAmt>
</Transaction>
<Transaction>
<TransCode>0015</TransCode>
<TransType>FinanceCharge</TransType>
<TransAmt>25.00</TransAmt>
</Transaction>
<Transaction>
<TransCode>0002</TransCode>
<TransType>Cash</TransType>
<TransAmt>50.00</TransAmt>
</Transaction>
<Transaction>
<TransCode>0008</TransCode>
<TransType>Purchase</TransType>
<TransAmt>40.00</TransAmt>
</Transaction>
</Transactions>