如何让 XSLT 在 chrome 中工作? [英] How can I make XSLT work in chrome?

查看:24
本文介绍了如何让 XSLT 在 chrome 中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 XML 文档 here 与相应的 XSL 文件.转换留待客户端执行,无需 JavaScript.

I have an XML document here that is served with a corresponding XSL file. The transformation is left to be executed client-side, without JavaScript.

这在 IE 中运行良好(震惊),但在谷歌浏览器中,只显示文档的文本节点.

This works fine in IE (shock horror), but in Google Chrome, just displays the document's text nodes.

我知道可以在 Chrome 中执行客户端 XSL,正如我所看到的例子,但我自己还没有能够复制这种成功

I know that it is possible to do client-side XSL in Chrome, as I have seen examples of it, but I am yet to be able to replicate this success myself

我做错了什么?

推荐答案

在撰写本文时,有一个 chrome 中的错误,需要 xmlns 属性才能触发渲染:

At the time of writing, there was a bug in chrome which required an xmlns attribute in order to trigger rendering:

<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" ... >

这是我在从服务器提供 xml 文件时遇到的问题.

This was the problem I was running into when serving the xml file from a server.

如果与我不同,您正在从 file:/// url 查看 xml 文件 ,那么提到 的解决方案--allow-file-access-from-files 是你想要的

If unlike me, you are viewing the xml file from a file:/// url, then the solutions mentioning --allow-file-access-from-files are the ones you want

这篇关于如何让 XSLT 在 chrome 中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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