edit: dobra, wy główkowałem coś takiego:
<?php function createTranslate( seylesheet ){ var stylesheetDoc = false; if (this.DOMParser){ var dp = new DOMParser(); stylesheetDoc = dp.parseFromString(seylesheet, "text/xml"); }else if (window.ActiveXObject){ stylesheetDoc = createMsxml2DOMDocumentObject(); stylesheetDoc.async = false; stylesheetDoc.load(seylesheet); } return( stylesheetDoc ); } function createMsxml2DOMDocumentObject(){ var msxml2DOM; "Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0"); for (var i=0; i<msxml2DOMDocumentVersions.length && !msxml2DOM; i++){ try{ msxml2DOM = new ActiveXObject(msxml2DOMDocumentVersions[i]); }catch (e) {} } if (!msxml2DOM) alert("Uaktualnij swoją wersję MSXML ze źródła n" + "http://msdn.microsoft.com/XML/XMLDownloads/default.aspx"); else return msxml2DOM; } function sparse(gridDivId, xml, xsl){ if (window.XMLHttpRequest && window.XSLTProcessor && window.DOMParser){ var xsltProcessor = new XSLTProcessor(); xsltProcessor.importStylesheet(xsl); page = xsltProcessor.transformToFragment(xml, document); var gridDiv = document.getElementById(gridDivId); gridDiv.innerHTML = ""; gridDiv.appendChild(page); }else if (window.ActiveXObject){ var theDocument = createMsxml2DOMDocumentObject(); theDocument.async = false; theDocument.load(xml); var gridDiv = document.getElementById(gridDivId); gridDiv.innerHTML = theDocument.transformNode(xsl); } } advAJAX.get({ url: "getdata.php", parameters : { "action" : "xmlfile" }, onSuccess : function(obj) { xmlObj = obj.responseXML; advAJAX.get({ url: "newsmain.xsl" , onSuccess : function(obj) { //xslObj = obj.responseText; if (window.ActiveXObject) xslObj = obj.responseXML; else xslObj = obj.responseText; var xslTrans = createTranslate(xslObj); sparse("div_srodek", xmlObj, xslTrans); }, onError : function(obj) { alert("Error: " + obj.status); } }); }, onError : function(obj) { alert("Error: " + obj.status); } }); ?>
Wszytko pięknie działa w FF, ale IE już pluje błędem, tłumacząc na polski to co wypluło ie chodzi o to że plik xml nie jest poprawny lub arkusz xsl jest pusty nie pasuje do pliku.. jak jest niepoprawny jak działa! :/
edit: Uf, dokopałem się do rozwiązania, temat można skasować lub zostawić bo może się komuś przydać, otóż należało zastąpić
czymś takim:
<?php xslObj = obj.responseText; ?>
<?php if (window.ActiveXObject) xslObj = obj.responseXML; else xslObj = obj.responseText; ?>