First of all, pardon my english.
I had the same problem on my old code project.
The problem it's few incompatibilities and definitions from XML or XSL documents.
function loadXMLDoc(dname){
var req;
if (typeof ActiveXObject !== 'undefined') {
req = new ActiveXObject('Msxml2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != 'undefined'){
req = new XMLHttpRequest();
}
if (req) {
req.open('GET', dname, false);
if (typeof XMLHttpRequest != 'undefined'){
req.responseType = "msxml-document";
}
req.send();
return req.responseXML;
}
}
function displayResult()
{
xml=loadXMLDoc("./src/xml/promociones.xml");
xsl=loadXMLDoc("./src/xsl/promociones.xsl");
if (typeof XMLHttpRequest != 'undefined'){
try{
ex=xml.transformNode(xsl);
$("#contentWrapper").append(ex);
}catch(e){
if (document.implementation && document.implementation.createDocument)
{
xsltProcessor=new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml,document);
$("#contentWrapper").append(resultDocument);
}
}
}
else if (document.implementation && document.implementation.createDocument)
{
xsltProcessor=new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml,document);
$("#contentWrapper").append(resultDocument);
}
}
I'm using jQuery but, the resultDocument var it's a HTML document returned after xsl processor, so you have a html code itself.
It's necessary to add a call to displayResult function after DOM document it's ready like this:
$(document).ready(function(){
displayResult();
});
The code is working on this site:
http://www.restauracion.elcorteingles.es/interior.html[
^]
I hope it's helpful.