Ahoj, nedaří se mi rozchodit tento JS. Nevím jak to zavolat se šablonou a xml daty :o/ Pomůže mi někdo prosím? Děkuji!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script language="javascript">
function Transform(xsltFile, xmlFile, whereToWrite) {
var xmlHttp;
var xsltHttp;
if (window.XMLHttpRequest) {
// Mozilla + Opera + Safari
xmlHttp = new XMLHttpRequest();
xsltHttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
try {
// MSIE 6+
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
xsltHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
// MSIE 5.5+
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
xsltHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
return false;
}
}
} else return false;
xmlHttp.open("GET", xmlFile, false);
xmlHttp.send(null);
var XML = xmlHttp.responseXML;
xsltHttp.open("GET", xsltFile, false);
xsltHttp.send(null);
var XSLT = xsltHttp.responseXML;
var xsltProc;
if (typeof XSLTProcessor != "undefined") {
xsltProc = new XSLTProcessor();
xsltProc.importStylesheet(XSLT);
var fragment = xsltProc.transformToFragment(XML, document);
document.getElementById(whereToWrite).appendChild(fragment);
} else {
document.getElementById(whereToWrite).innerHTML = XML.transformNode(XSLT);
}
}
</script>
</head>
<body onload="Transform()">
</body>
</html>