当我尝试 运行 xml 文件时,浏览器显示消息错误加载样式表:失败分析 XSLT 样式表

When i am trying to run the xml file, browser show me the message Error loading stylesheet: Failure analysis XSLT stylesheet

正如我在上面的标题中所述,我不知道哪里出了问题,也不知道为什么浏览器(firefox、IE)会向我显示此消息(加载样式表时出错:XSLT 样式表失败分析)。我将post放在xml文件和xsl文件下面。

exam.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="exam.xsl"?>
<Exam>
    <Title>XML_Master_Exam</Title>
    <Information>
        <ExamName ExamNumber="I10-001">XML Master:Basic</ExamName>
        <ExamTime>60_Minutes</ExamTime>
        <Qeustions>50</Qeustions>
        <MinimumPass>at_least_70% correct</MinimumPass>
    </Information>
    <Information>
        <ExamName ExamNumber="I10-002">XML Master:Professional</ExamName>
        <ExamTime>90_Minutes</ExamTime>
        <Qeustions>40</Qeustions>
        <MinimumPass>at_least_60% correct</MinimumPass>
    </Information>
</Exam>

exam.xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XMLTransform">
<xsl:template match="/">
    <test_info>
        <xsl:apply-templates select="//MinimumPass"/>
    </test_info>
</xsl:template>

<xsl:template match="MinimumPass">
    <test_no>
        <xsl:value-of select="../ExamName/@ExamNumber"/>
    </test_no>
</xsl:template>
</xsl:transform>

xsl 的命名空间有误。您需要使用 http://www.w3.org/1999/XSL/Transform:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
    <test_info>
        <xsl:apply-templates select="//MinimumPass"/>
    </test_info>
</xsl:template>

<xsl:template match="MinimumPass">
    <test_no>
        <xsl:value-of select="../ExamName/@ExamNumber"/>
    </test_no>
</xsl:template>
</xsl:transform>