0
我試圖循環所需要的表裏面印有數據元素 這裏是我的xml文件XSL爲每一個元素
<hotels xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:noNamespaceSchemaLocation='5.xsd'>
<hotel ID="1">
<Name>Les Jardins du Marais</Name>
<Stars>3</Stars>
<Facilities>Internet</Facilities>
<Address>74 reu Amelot, Paris, 75011</Address>
<Distance>2</Distance>
<Available>true</Available>
</hotel>
<hotel ID="2">
<Name>Golden Tulip Little Palace</Name>
<Stars>4</Stars>
<Facilities>Internet</Facilities>
<Facilities>Gym</Facilities>
<Facilities>Parking</Facilities>
<Facilities>Restaurant</Facilities>
<Address>4 rue salomo,De caus, Paris, 75003</Address>
<Distance>0.1</Distance>
<Available>false</Available>
</hotel>
<hotel ID="3">
<Name>Tilsitt Etoile</Name>
<Stars>2</Stars>
<Facilities>Restaurant</Facilities>
<Address>23 rue brey, Paris, 75017</Address>
<Distance>3</Distance>
<Available>false</Available>
</hotel>
<hotel ID="4">
<Name>Hotel saint charles</Name>
<Stars>3</Stars>
<Facilities>Parking</Facilities>
<Address>6 rue de 1'Esperance, Paris, 75013</Address>
<Distance>1</Distance>
<Available>true</Available>
</hotel>
這裏是我的XSL文件
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<body>
<h2>Students</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>ID</th>
<th>Name</th>
<th>Stars</th>
<th>Facilites</th>
<th>Address</th>
<th>Distance</th>
<th>Available</th>
</tr>
<xsl:for-each select="hotels/*">
<tr>
<td>
<xsl:value-of select="@ID"/>
</td>
<td>
<xsl:value-of select="Name"/>
</td>
<td>
<xsl:value-of select="Stars"/>
</td>
<td>
<xsl:value-of select="Facilities"/>
</td>
<td>
<xsl:value-of select="Address"/>
</td>
<td>
<xsl:value-of select="Distance"/>
</td>
<td>
<xsl:value-of select="Available"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
由於有多個單一酒店我需要fi發出如何循環該設施,任何幫助將graet並提前感謝
請張貼預期的結果。 –