Counting unique XML element attributes using XSLT
Posted
by
patrick_corrigan
on Stack Overflow
See other posts from Stack Overflow
or by patrick_corrigan
Published on 2012-06-05T16:02:38Z
Indexed on
2012/06/05
16:40 UTC
Read the original article
Hit count: 144
I've just started using XSLT and am trying to figure this out. Your help would be greatly appreciated.
Example XML file
<purchases>
<item id = "1" customer_id = "5">
</item>
<item id = "2" customer_id = "5">
</item>
<item id = "7" customer_id = "4">
</item>
</purchases>
Desired HTML Output:
<table>
<tr><th>Customer ID</th><th>Number of Items Purchased</th></tr>
<tr><td>5</td><td>2</td></tr>
<tr><td>4</td><td>1</td></tr>
</table>
Customer with id number 5 has bought 2 items. Customer with id number 4 has bought 1 item.
© Stack Overflow or respective owner