IE9 中的 XSL 转换 XMLDocument 问题
我有以下 JavaScript 来转换 XSL/XML 文件。
var xmlData = document.getElementById(controlID.value + "_XmlData");
var xsltData = document.getElementById(controlID.value + "_XsltData");
// Transform the XML using the specified XSLT file.
if ((xmlData != null) && (xsltData != null))
reportDisplayControl.innerHTML = xmlData.transformNode(xsltData.XMLDocument);
我遇到的问题是该文件无法在 IE9 中呈现。 但是,如果我打开兼容模式,它就可以正常工作。
我注意到以下内容:
- 放置以下代码:
alert(xmlData);
会产生以下结果:- IE9 本机:
[object HTMLUnknownElement]
- IE9兼容模式:
[对象]
- IE9 本机:
- 放置
alert(xmlData.XMLDocument);
会导致下列:- IE9 本机:
未定义
- IE9 cm:
[对象]
- IE9 本机:
有人可以帮助我在 IE 9 本机模式下使用此功能吗?
I have the following JavaScript to transform an XSL/XML file.
var xmlData = document.getElementById(controlID.value + "_XmlData");
var xsltData = document.getElementById(controlID.value + "_XsltData");
// Transform the XML using the specified XSLT file.
if ((xmlData != null) && (xsltData != null))
reportDisplayControl.innerHTML = xmlData.transformNode(xsltData.XMLDocument);
I'm having an issue where the file does not get rendered in IE9.
However, if I turn on compatibility mode, it works just fine.
I've noticed the following:
- Placing the following code:
alert(xmlData);
results in the following:- IE9 native:
[object HTMLUnknownElement]
- IE9 compatibility mode:
[object]
- IE9 native:
- Placing an
alert(xmlData.XMLDocument);
results in the following:- IE9 native:
undefined
- IE9 c.m.:
[object]
- IE9 native:
Can someone help me get this working in IE 9 native mode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到这个问题...我环顾四周,发现 IE9 中已删除对 XMLDocument 属性的支持 http://help.dottoro.com/ljcdspjd.php
还看到一个博客提供了解决方法
http://www.roelvanlisdonk.nl/?p=2113
这可能对你有用......
感谢
更新:
我通过使用 JavaScript 中的 XMLHttprequest 对象异步传递 xml,然后直接调用 singleNode 解决了这个问题。
干杯
i was having this issue to... i had a look around and found out that the support for the XMLDocument property has been removed in IE9 http://help.dottoro.com/ljcdspjd.php
Also saw a blog that provided a workaround
http://www.roelvanlisdonk.nl/?p=2113
this might work for you...
Thanks
Update:
i solved the problem by passing the xml back asyncronously using an XMLHttprequest object in javascript and then calling the singleNode direclty.
cheers