【问题标题】:xsl document test failing in IE8 and 9?xsl 文档测试在 IE8 和 9 中失败?
【发布时间】:2012-04-05 08:44:09
【问题描述】:

我在 XLST 文档中有以下内容

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:str="http://xsltsl.org/string" xmlns:dt="http://xsltsl.org/date-time" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes">
<xsl:if test="document('../folder/somefile.xml')">
    <!-- do stuff -->
</xsl:if>

在 IE8 和 IE9 中尝试处理此文件会导致 JavaScript 错误,“系统无法找到指定的对象” - 并且转换错误。

我已阅读 XLST2.0 中的“文档可用”功能,但尝试使用它只会给我一个错误,即该功能不可用。

我已经看到了这个问题:How check document is available in xsl? - 但我不想添加依赖于处理器的代码,所以我希望我只是缺少“doc-available”的一些东西。

【问题讨论】:

    标签: xslt xslt-2.0


    【解决方案1】:

    我认为the XSLT 1.0 specification(IE 使用的 MSXML 是 XSLT 1.0 处理器)允许 XSLT 处理器执行“发出错误信号”或在 document() 调用失败时通过返回空节点集来继续。因此,MSXML 报告错误是允许的,而不是错误。您需要确保在 XSLT 之外该文件存在。

    【讨论】:

      猜你喜欢
      • 2012-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-06
      相关资源
      最近更新 更多