我有我想要使用XSLT在HTML表格中显示这个XML文件:显示XML文件
<bottle>
<composition>
<ion type="positif">calcium 67.32mg/l</ion>
<ion type="positif">magnésium 10.08mg/l</ion>
<ion type="negatif">chlorure 20.82mg/l</ion>
<ion type="negatif">nitrate 3.5mg/l</ion>
<autre type="metal">fer</autre>
</composition>
</bottle>
<bottle>
<composition>
<ion type="positif">calcium 60.32mg/l</ion>
<ion type="positif">magnésium 15.28mg/l</ion>
<ion type="negatif">chlorure 25.2mg/l</ion>
<ion type="negatif">nitrate 1.5mg/l</ion>
</composition>
</bottle>
我要显示这样的每一个节点:
----------------------------------
composition | positif |
|--------------------|
| calcium 67.32mg/l |
| magnésium 10.08mg/l|
|--------------------|
| negatif |
|--------------------|
| chlorure 20.82mg/l |
| nitrate 3.5mg/l |
|--------------------|
| autre |
|--------------------|
| fer |
---------------------------------|
这是我设法做的,它不显示任何东西:
<tr>
<th rowspan="6">Composition</th>
<xsl:for-each select="document('Pub.xml')/Magasin/bouteille/composition[count(.| key('type-ion',@type)[1])=1]">
<th> <xsl:value-of select="@type"/> </th>
<tr>
<td><xsl:for-each select="key('type-ion',@type)">
<xsl:value-of select="."/>
</xsl:for-each></td>
</tr>
</xsl:for-each>
</tr>
你能帮我吗?
究竟什么是你的问题? –
如何使用xslt在表中显示该xml文件? – Mina
你到底在哪?这是一个提出问题的地方,不要让你的代码为你写。 –