xml - XML 在应用 XLST 转换后是空白的?
问题描述
不确定我是否在这里遗漏了什么,因为这是我第一次这样做。如果重要的话,这两个文件都在同一个文件夹中(xml 和 xsl)。
xml 示例:
<?xml-stylesheet type="text/xsl" href="cd_catalog.xsl"?>
<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
</CATALOG>
还有我的 xsl 文件:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template match="/">
<html>
<body>
<h1>Title</h1>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
<th>Year</th>
<th>Price</th>
</tr>
<xsl:for-each select="CATALOG/CD">
<tr>
<td><xsl:value-of select="TITLE"/></td>
<td><xsl:value-of select="ARTIST"/></td>
<td><xsl:value-of select="YEAR"/></td>
<td><xsl:value-of select="PRICE"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
解决方案
推荐阅读
- python - 如何在文本文件中附加打印的脚本?
- php - htaccess 问题。一条规则有效,另一条无效
- html - Jquery 'click' 功能仅适用于“if”语句,不适用于“else if”
- linux - Linux NetEm-测量的数据包损坏方式太低
- javascript - Highcharts 树状图
- javascript - 生成器返回在 for-await-of 循环中不起作用
- php - 如何获取 next_post() 链接以使用手动排序而不是 Wordpress 中的默认页面 ID 排序?
- typescript - 如何使用 Typescript 对可能的空数组进行建模
- python - 捆绑提取具有地牢的每个链接将它们分开并将每个链接添加到列表中并删除重复项
- rest-assured-jsonpath - Jayway JSONPath 元素检索