Combine XML elements with xsl
- by mpenrow
I have the following xml:
<RowSet>
<Row>
<Number>12345</Number>
<Quantity>42</Quantity>
</Row>
<Row>
<Number>12345</Number>
<Quantity>12</Quantity>
</Row>
<Row>
<Number>54321</Number>
<Quantity>37</Quantity>
</Row>
</RowSet>
I want to use an xsl to combine the elements with the same Number and the resulting should sum the Quantity elements. So the output should look like this:
<RowSet>
<Row>
<Number>12345</Number>
<Quantity>64</Quantity>
</Row>
<Row>
<Number>54321</Number>
<Quantity>37</Quantity>
</Row>
</RowSet>