我有这两个元素的XML文件
<ATTRIB_GROUPS><![CDATA[40,41,42,42,5]]></ATTRIB_GROUPS>
<ATTRIB_QUANT><![CDATA[1,1,1,2]]></ATTRIB_QUANT>
这是我的XSLT样式表
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Products</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th style="text-align:left">Name</th>
<th style="text-align:left">Reference</th>
<th style="text-align:left">Quantity</th>
<th style="text-align:left">Size</th>
<th style="text-align:left">Size Quantity</th>
<th style="text-align:left">Price</th>
</tr>
<xsl:for-each select="products/item">
<tr>
<td><xsl:value-of select="NAME"/></td>
<td><xsl:value-of select="REFERENCE"/></td>
<td><xsl:value-of select="QUANTITY"/></td>
<td><xsl:value-of select="ATTRIB_GROUPS"/></td>
<td><xsl:value-of select="ATTRIB_QUANT"/></td>
<td><xsl:value-of select="substring(PRICE, 1, 6)"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
所以HTML输出看起来像
Name | Reference | Quantity | Size | Size Quantity | Price
Shoe 1 | REF1 | 59 | 36,36.5,37,5,38,38,5,39,40,40,5,41,42,42,5,43 | 2,2,3,4,5,5,5,5,7,7,7,7 | 999.99
Shoe 2 | REF2 | 8 | 40,41,42,42,5,43,44,44,5,45,46,47,5 | 1,1,1,1,1,1,0,1,0,1 | 899.99
我希望像使用XSLT样式表的HTML表一样显示这些数据。
--------------------------------------
| |
| Size |
| |
--------------------------------------
| | | | |
|40 - 1 | 41 - 1 | 42 - 1 | 42,5 - 2 |
| | | | |
--------------------------------------
有什么想法吗?请不要怪我。我是XSLT的新手