/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function xslt(xmlDoc,xslDoc) { var transform; if (typeof ActiveXObject != 'undefined') { transform = xmlDoc.transformNode(xslDoc); } else { var xsl = new XSLTProcessor(); xsl.importStylesheet(xslDoc); var fragment=xsl.transformToFragment(xmlDoc, document); if( fragment.childNodes.length>0 ) transform = fragment.childNodes[0].innerHTML; else alert("error"); } return transform; }