2
我有这个XML文件:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="catalog.xsl"?>
<catalog>
<album>
<title>Exodus</title>
<artist>Bob Marley</artist>
<country>Jamaica</country>
<price>19,99</price>
</album>
<album>
<title>Black Album</title>
<artist>Metallica</artist>
<country>USA</country>
<price>20,00</price>
</album>
<album>
<title>Nevermind</title>
<artist>Nirvana</artist>
<country>USA</country>
<price>22,00</price>
</album>
</catalog>
可链接到这个XSL文件:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My Catalog</h2>
<table border="1">
<tr bgcolor="#9ACD32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/album">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
w ^当我在浏览器中打开XML文件时,我没有看到任何显示内容。由于我按照指示复制了教程,所以我不确定这里出了什么问题。你有什么线索可能导致缺乏显示?
它实际上是为我工作。浏览器问题? – keyser
@Keyser:我在Chrome中试过。你在尝试这个? – stanigator
也为我工作。 – Drona