WebKit浏览器使用XSLT文档() [英] XSLT document() usage with WebKit browsers

查看:159
本文介绍了WebKit浏览器使用XSLT文档()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在XSL样式表中包含和访问多个XML文档时遇到问题。我将文档节点分配为变量,然后试图在我的xsl:模板中访问它们,与此类似:

I'm having an issue when attempting to include and access multiple XML documents in an XSL stylesheet. I'm assigning document nodes as variables and then attempting to access them in my xsl:template, similar to this:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
  <xsl:output method="xml" omit-xml-declaration="yes" />

  <xsl:variable name="doc1" select="document('test.xml')" />

  <xsl:template match="/">
  <div>
    <span id="id_total">
      <xsl:value-of select="count($doc1//Root)"/>
    </span>
  </div>
  </xsl:template>

</xsl:stylesheet>

使用IE& Firefox,但是任何WebKit浏览器(Safari,Chrome)都会给我一个数量为0的值。任何想法?

I get the correct count when using IE & Firefox, however any WebKit browser (Safari, Chrome) gives me a count of 0. Any thoughts?

推荐答案

允许.xml文件从文件中读取.xlst文件:// URL是一个安全漏洞,它们已经阻止了它。

Google have decided that allowing the .xml file to read the .xlst file off a file:// URL is a security hole and they have blocked it.

chrome.exe命令行选项 - 允许从文件访问文件将规避这种安全措施。

The chrome.exe command line option --allow-file-access-from-files will circumvent this safeguard.

这篇关于WebKit浏览器使用XSLT文档()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆