我遇到了Internet Explorer 9和Firefox 13的一些问题。我使用HTML,XSL和XML构建Web Interface,它工作正常与Chrome,Opera和Safari没有任何变化,但它不适用于Firefox 13和Internet Explorer 9.使用Firefox,有一些页面(不是全部)无法加载XML值,在Internet Explorer中我无法使用为使用XSLT的html页面加载css,但我可以正确加载所有参数。XSLT适用于Opera,Safari和Chrome,但不适用于Firefox 13和Internet Explorer 9
在上面,你可以找到一个页面的例子不工作(HTML,XML,XSL)
HTML
<html>
<head>
<script>
function loadXMLDoc(dname)
{
if (window.XMLHttpRequest)
{
xhttp=new XMLHttpRequest();
}
else
{
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET",dname+"?id="+Math.random(),false);
xhttp.send("");
return xhttp.responseXML;
}
function displayResult()
{
xml=loadXMLDoc("sensorParameters.xml");
xsl=loadXMLDoc("sensorParameters.xsl");
// code for IE
if (window.ActiveXObject)
{
ex=xml.transformNode(xsl);
document.getElementById("example").innerHTML=ex;
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{
xsltProcessor=new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml,document);
document.getElementById("example").appendChild(resultDocument);
}
}
</script>
</head>
<body onload="displayResult()">
<div id="example" />
</body>
<head>
<meta http-equiv="cache-control" content="no-cache">
</head>
</html>
XSL
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<head>
<title>Interface</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
...
(It continues, but it is not important...)
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="sensorParameters.xsl"?>
<section1>
<section2>
......... some data
</section2>
<section3>
......... some data
</section3>
.........
</section1>
任何帮助将升值ated。
马尔科
你可以发布一个URL到一个最小但完整的样本,该样本在Firefox中失败并更详细地解释例如失败的例子。如果你得到一个错误,究竟是哪一个? –
您可能会喜欢Saxon-CE,希望能够解决大部分跨浏览器兼容性问题。 –
@MartinHonnen您好马丁,谢谢您的回复。我无法发布网址,因为我在本地工作。会发生什么情况是,如果我有一张表格,我想从XML文件中填充一些值,则Firefox无法加载它们。但是,如果我使用萤火虫查看页面的来源,我发现firefox正确加载参数,但无法显示它们。 – user1474456