Xsl mime type problem
Posted
by
savruk
on Stack Overflow
See other posts from Stack Overflow
or by savruk
Published on 2011-03-14T14:55:52Z
Indexed on
2011/03/14
16:09 UTC
Read the original article
Hit count: 344
Hi,
I have a busybox with lighttpd running on as http server. My problem is while firefox and opera can get the page with applied xsl, Arora(webkit) can not. Here is the script I use to get it work:
<html>
<head>
<script>
function loadXMLDoc(dname)
{
if (window.XMLHttpRequest)
{
xhttp=new XMLHttpRequest();
}
else
{
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET",dname,false);
xhttp.send("");
return xhttp.responseXML;
}
function querySt(ji) {
hu = window.location.search.substring(1);
gy = hu.split("&");
for (i=0;i<gy.length;i++) {
ft = gy[i].split("=");
if (ft[0] == ji) {
return ft[1];
}
}
}
function displayResult()
{
xml=loadXMLDoc("sample.xml");
alert(xml)//Gives [object Document]
$scan=querySt("scan");
$sub = querySt("sub");
xsl=loadXMLDoc("sample.xsl");
alert(xsl)//Gives Null
// 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);
xsltProcessor.setParameter(null,"scan",$scan)
if($sub != ""){
xsltProcessor.setParameter(null,"sub",$sub)
}
resultDocument = xsltProcessor.transformToFragment(xml,document);
document.getElementById("example").appendChild(resultDocument);
}
}
</script>
</head>
<body onload="displayResult()">
<div id="example" ></div>
</body>
</html>
I tried to see if it load xsl well and put an alert(xsl) but it gives null. Other browser can get xml and xsl files perfectly.
What can be the problem? Thanks
P.S: It runs well on my local server with all browser.
© Stack Overflow or respective owner