html
<html>
<head >
<meta charset="utf-8" />
<script type="text/javascript">
window.onload = function ()
{
//use XHR to load
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("get", "simple.xml", false);
xmlhttp.send(null);
var xmldom = xmlhttp.responseXML;
xmlhttp = new XMLHttpRequest();
xmlhttp.open("get", "simple.xsl", false);
xmlhttp.send(null);
var xsltdom = xmlhttp.responseXML;
var processor = new XSLTProcessor();
processor.importStylesheet(xsltdom);
var result = processor.transformToDocument(xmldom);
var div = document.getElementById("divResult");
var xml = (new XMLSerializer()).serializeToString(result);
div.innerHTML = xml;
}
</script>
</head>
<div id="divResult"></div>
<body>
</body>
</html>
simple.xsl和simple.xml是对应的待加载的xml和xsl文件