我正在尝试复制此表,该表具有3列,而另一个表具有“每晚平均价格”列,但是我无法使其与我的表匹配。这是我的桌子的样子
这是我的代码。我只是想知道为什么我的专栏看起来不是这样,
<xsl:template match="/">
<html>
<head>
<title></title>
</head>
<body>
<h1>Hotels in the Key West Area</h1>
<table class="first">
<tr>
<p><th><h2>Name</h2></th>
<th><h2>Rating</h2></th>
<th><h2>Average Price Per Night</h2></th></p>
</tr>
<xsl:for-each select ="ArrayOfHotelListItems/HotelListItems">
<xsl:sort select="Rating" order="descending" data-type="number" />
<tr>
<td><p><xsl:apply-templates select="Name"/></p></td>
<td><p><xsl:apply-templates select="Rating" /></p></td>
<td>
<table class="second">
<xsl:for-each select="./Rooms/Room">
<td>
<xsl:value-of select="RoomType"/> = $<xsl:value-of select="Rate"/>
</td>
</xsl:for-each>
</table>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
除了一些样式设置外,不确定您的问题是什么,因为您似乎正在正确地复制嵌套表。但是,查看您的HTML,我将其添加为使其更“合适”:
<table class="second">
<tr>
<xsl:for-each select="./Rooms/Room">
<td>
<xsl:value-of select="RoomType"/> = $<xsl:value-of select="Rate"/>
</td>
</xsl:for-each>
</tr>
</table>
*请注意已添加表格行标记。...
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句