我有一个包含酒店信息的XML文件,我尝试使用XSL显示,但数据不显示在网页上(我没有HTML表格)。我在StackOverflow上阅读了很多帖子,但是我仍然看不到我的错误可能在哪里。XSL不显示HTML表格
我的XML文件的摘录:我的XSL代码
<entries xmlns="http://ref.otcnice.com/webservice/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:SchemaLocation="http://ref.otcnice.com/webservice/entries.xsd">
<entry>
<ID>1021</ID>
<name_fr>AC BY MARRIOTT NICE</name_fr>
<name_fr_short>AC BY MARRIOTT NICE</name_fr_short>
<address>
<address_line1>59 Promenade des Anglais</address_line1>
<address_line2/>
<address_line3/>
<zip>06000</zip>
<city>NICE</city>
</address>
<phone>+33 (0)4 93 97 90 90</phone>
</entry>
<!--.........-->
</entries>
部分:
<table class="table table-bordered table-hover table-striped">
<tr>
<th>Nom</th>
<th width='380'>Adresse</th>
<th width='175'>Téléphone</th>
<th>Site Web</th>
</tr>
<xsl:for-each select="entries/entry">
<tr>
<td>
<xsl:element name="a">
<xsl:attribute name="href">/ProjetMiage/detail /?id=<xsl:value-of select="ID"/>
</xsl:attribute>
<xsl:attribute name="target">detail
</xsl:attribute>
<xsl:value-of select="name_fr"/>
</xsl:element>
</td>
<td>
<xsl:value-of select="address"/>
</td>
<td>
<xsl:value-of select="phone"/>
</td>
<td>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="website"/>
</xsl:attribute>
<xsl:attribute name="target">
blank
</xsl:attribute>
<xsl:value-of select="website"/>
</xsl:element>
</td>
</tr>
</xsl:for-each>
</table>
它看起来像你还没有宣布由在'entries'元素中使用的命名空间的前缀源XML,以便引用'entries/entry'不选择任何内容。全面查看这两份文件将会有所帮助。 –