Here is the source XML code:
<customers>
<customer cid="c5391">
<name>Evans, Terry</name>
<street>641 Greenway Blvd.</street>
<city>Mount Hope</city>
<state>OH</state>
<zip>44660</zip>
<orders>
<order oid="52517">
<date>8/1/2017</date>
<item iid="wb7133">
<description>Insulated Water Bottle</description>
<qty>2</qty>
</item>
<item iid="gps1015">
<description>Zendo GPS meter</description>
<qty>1</qty>
</item>
<item iid="bl2815">
<description>Boot Laces (Medium)</description>
<qty>1</qty>
</item>
<item iid="tr8140">
<description>Trail Mix (Pouch)</description>
<qty>5</qty>
</item>
<item iid="fa8442">
<description>First Aid Kit (Pack Size)</description>
<qty>1</qty>
</item>
<item iid="bb7117">
<description>Blister Patches</description>
<qty>3</qty>
</item>
</order>
<order oid="53003">
<date>8/5/2017</date>
<item iid="hp7814">
<description>Fiberglass Light Hiking Poles (Spring Adj.)</description>
<qty>1</qty>
</item>
</order>
<order oid="54814">
<date>8/6/2017</date>
<item iid="sb6601">
<description>Solar Battery Recharging Unit</description>
<qty>1</qty>
</item>
<item iid="br9002">
<description>Bug Repellent (Deep Woodes)</description>
<qty>2</qty>
</item>
<item iid="sb8502">
<description>Sunblock SPF 30 (Hiking Size)</description>
<qty>6</qty>
</item>
</order>
</orders>
</customer>
</customers>
I am trying to use XSL/HTML/CSS to reformat the code to look like below:
Here is my code, I am trying to create different order tables for each order (listed in descending order by order ID as shown in the sample photo above). Also, each order table should include the date of the order and the order ID:
<table>
<tr>
<th>Item No.</th>
<th>Description</th>
<th>Qty</th>
</tr>
<xsl:for-each select="//order/item" group-by="date">
<xsl:sort select="order/@oid" data-type="number" order="descending"/>
<tr>
<td>
<xsl:value-of select="@iid"></xsl:value-of>
</td>
<td>
<xsl:value-of select="description"></xsl:value-of>
</td>
<td>
<xsl:value-of select="qty"></xsl:value-of>
</td>
</tr>
</xsl:for-each>
</table>
The result look like below.
Right now my code is returning all the items, but I need to create multiple tables based for each order, which I am not sure how to do.