我已经创建了一个名为"class“的简单xml文件,并将其保存到我的桌面上
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="class.xsl"?>
<class>
<student>Jack</student>
<student>Harry</student>
<student>Rebecca</student>
<teacher>Mr. Bean</teacher>
</class>
然后,我创建了一个名为"class.xsl“的xsl文件来执行一些xslt,并将其保存到我的桌面上。
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="class">
<html>
<body>
<xsl:apply-templates select="student"/>
</body>
</html>
</xsl:template>
<xsl:template match="student">
<p>
Found a learner!
</p>
</xsl:template>
</xsl:stylesheet>
当我单击class.xml文件时,它试图将其加载到internet explorer中,并显示以下错误:
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Invalid at the top level of the document. Error processing resource 'file:///C:/Documents and Settings/nlamarca/Desktop/cla...
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
^
我在这里做错了什么?
发布于 2011-03-23 15:33:20
您需要将其保存为文本格式。您可能使用过MS Word或写字板或类似的工具来编辑代码。当您保存它时,它是以RTF格式保存的。此格式不适合您尝试执行的任务。
任一
中将其保存为纯文本格式
https://stackoverflow.com/questions/5407605
复制相似问题