function Transform() { var xsltProcessor = new XSLTProcessor(); //Load XSL xslStylesheet = document.implementation.createDocument("", "doc", null); xslStylesheet.async = false; xslStylesheet.load("Example.xsl"); xsltProcessor.importStylesheet(xslStylesheet); //Load XML xmlDoc = document.implementation.createDocument("", "doc", null); xmlDoc.async = false; xmlDoc.load("Example.xml"); //Transform var fragment = xsltProcessor.transformToFragment(xmlDoc, document); document.getElementById("example").appendChild(fragment); }