<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="vehicles.xsl"?>
<!-- File Name : vehicles.xml -->
<data>
<params>
<returned_page>1</returned_page>
<total_pages>6</total_pages>
<items_count>56</items_count>
<previous_page></previous_page>
<next_page>2</next_page>
</params>
<grid>
<row>
<car_id>1</car_id>
<car_name>Audi A1</car_name>
<car_price_per_day>75.33</car_price_per_day >
<car_availability>1</car_availability>
</row>
<row>
<car_id>2</car_id>
<car_name>IQ 30</car_name>
<car_price_per_day>45.99</car_price_per_day >
<car_availability>1</car_availability>
</row>
<row>
<car_id>3</car_id>
<car_name>BMW 320</car_name>
<car_price_per_day>86.44</car_price_per_day >
<car_availability>0</car_availability>
</row>
<row>
<car_id>4</car_id>
<car_name>Ford Fiesta</car_name>
<car_price_per_day >54.68</car_price_per_day>
<car_availability>0</car_availability>
</row>
<row>
<car_id>5</car_id>
<car_name>Volkswagen Scirocco</car_name>
<car_price_per_day >65.99</car_price_per_day >
<car_available >0</car_available >
</row>
</grid>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:xsl="htp://www.w3.org/1999/XSL/Transform">
<!-- File Name : vehicles.xsl -->
<xsl:template match="/">
<html>
<body>
<h2>CARS</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>ID</th>
<th>Name</th>
<th>Price/Day</th>
<th>Availability</th>
</tr>
<xsl:for-each select="row">
<tr>
<td>
<xsl:value-of select="car_id"/>
</td>
<td>
<xsl:value-of select="car_name"/>
</td>
<td>
<xsl:value-of select="car_price_per_day"/>
</td>
<td>
<xsl:value-of select="car_availability"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
我的探索者都没有打开样式表..找不到它有什么问题我尝试了另一种编码,“选择值”命令的完整路径,“数据”和“行”作为模板匹配但输出相同。我试过 ie,mozila firefox 和 google chrome chrome 给了我一个空白页,即 xml 文件在单行和 firefox “加载样式表时出错:解析 XSLT 样式表失败。” 有任何想法吗?