任何人都可以帮助我吗?我正在尝试为我的课程学习使用 xsl 设计 xml,并且正在观看 youtube 上的视频教程。我看到并复制了他正在输入的内容,我看到它有效,但是当我在浏览器上运行我自己的 xml 和 xsl 文件时,它说...
This XML file does not appear to have any style information associated with it. The document tree is shown below.
这是我的 xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='Text/xsl' href='Places.xsl' ?>
<Philipppines_Place>
<Places>
<title>Philippines</title>
<description>Country</description>
</Places>
<Places>
<title>Russai</title>
<description>Country</description>
</Places>
</Philipppines_Place>
这是我的 xsl 文件
<xml version = "1.0" encoding = "UTF-8">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/Philippines_Place">
<html>
<body>
<xsl:for-each select="Places">
<xsl:value-of select="title" /><br />
<xsl:value-of select="description" /><br />
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
使用
<?xml version="1.0" encoding="UTF-8"?>
形式的正确 XML 声明语法,您可能会取得更大的成功,尽管在过去几年中,浏览器供应商已经关闭了从文件系统(通常是浏览器控制台)加载 XML 的客户端 XSLT 的大门(F12 往往会打开它)将显示安全错误或警告,提示您来自本地文件系统的样式表尚未加载。