Skip to content
ottoville edited this page Feb 10, 2016 · 1 revision

An example for saxonce processor

<html>
<head>
<script src="SaxonceDebug/Saxonce.nocache.js"></script>
</head>
<body>
<script>
var docxrequest=new XMLHttpRequest;
var saxonready=false;
var onSaxonLoad=function() {
	saxonready=true;
 }
var dotransfor=function(stylesheet, xmlDoc) {
	var xsltProcessor = Saxon.newXSLT20Processor(stylesheet)
	var parser=new DOMParser();
	resultDocument = xsltProcessor.transformToFragment(xmlDoc,document);
	document.body.appendChild(resultDocument);
}
docxrequest.open("GET",'unzippedfolder/word/document.xml',true);
	docxrequest.onload=function() {
		var xmlDoc=this.responseXML;
		var xmlhttp=new XMLHttpRequest;
		xmlhttp.open("GET",'DOCX2HTML/docx2html.xsl',true);
		xmlhttp.onload=function() {
			if (this.status == 200) {
				if(saxonready)
					dotransfor(this.responseXML,xmlDoc)
				 else {
					var stylesheet=this.responseXML
					onSaxonLoad=function() {
						dotransfor(stylesheet,xmlDoc);
					}
				 }
			 }
		}
		xmlhttp.send();
	 }
docxrequest.send(); 
</script>
</body>
</html>
Clone this wiki locally