我有如下 XML
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<Bundles>
<BundleID>1</BundleID>
<BundleDetails>
<Classification>A</Classification>
<TrackingID>34675</TrackingID>
</BundleDetails>
<BundleQty>12</BundleQty>
</Bundles>
<Bundles>
<BundleID>2</BundleID>
<BundleDetails>
<Classification>B</Classification>
<TrackingID>4563</TrackingID>
</BundleDetails>
<BundleDetails>
<Classification>A</Classification>
<TrackingID>4563</TrackingID>
</BundleDetails>
<BundleQty>34</BundleQty>
</Bundles>
<Bundles>
<BundleID>3</BundleID>
<BundleDetails>
<Classification>A</Classification>
<TrackingID>2343243</TrackingID>
</BundleDetails>
<BundleQty>22</BundleQty>
</Bundles>
<Bundles>
<BundleID>4</BundleID>
<BundleDetails>
<Classification>A</Classification>
<TrackingID>123231</TrackingID>
</BundleDetails>
<BundleDetails>
<Classification>B</Classification>
</BundleDetails>
<BundleDetails>
<Classification>B</Classification>
<TrackingID>42342</TrackingID>
</BundleDetails>
<BundleQty>33</BundleQty>
</Bundles>
<Bundles>
<BundleID>5</BundleID>
<BundleDetails>
<Classification>A</Classification>
<TrackingID>123231</TrackingID>
</BundleDetails>
<BundleDetails>
<Classification>A</Classification>
<TrackingID>42342</TrackingID>
</BundleDetails>
<BundleDetails>
<Classification>B</Classification>
<TrackingID>124512</TrackingID>
</BundleDetails>
<BundleQty>21</BundleQty>
</Bundles>
</Set>
我需要获取每个 Set/Bundles 的详细信息,如下所示
Bundle# Qty Classes
1 12 A
2 34 A,B
3 22 A
4 33 A,B
5 21 A,B
我开始如下,但在获得不同的课程列表时感到震惊。需要一些指导,
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<p>Set Details</p>
<table>
<xsl:for-each select="Set/Bundles">
<tr>
<td><xsl:value-of select="BundleID"/></td>
<td><xsl:value-of select="BundleQty"/></td>
<td>--Distinct List of ./BundleDetails/Classification </td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
提前感谢您的帮助!
谢谢!