1*83a54b2fSSadaf Ebrahimi<html> 2*83a54b2fSSadaf Ebrahimi<head> 3*83a54b2fSSadaf Ebrahimi<title>beust.com</title> 4*83a54b2fSSadaf Ebrahimi<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5*83a54b2fSSadaf Ebrahimi<style>@import url("web/site.css");</style> 6*83a54b2fSSadaf Ebrahimi<script type="text/javascript"> 7*83a54b2fSSadaf Ebrahimi var returnval = 0; 8*83a54b2fSSadaf Ebrahimi var stylesheet, xmlFile, cache, doc; 9*83a54b2fSSadaf Ebrahimi function init(){ 10*83a54b2fSSadaf Ebrahimi // NSCP 7.1+ / Mozilla 1.4.1+ / Safari 11*83a54b2fSSadaf Ebrahimi // Use the standard DOM Level 2 technique, if it is supported 12*83a54b2fSSadaf Ebrahimi if (document.implementation && document.implementation.createDocument) { 13*83a54b2fSSadaf Ebrahimi xmlFile = document.implementation.createDocument("", "", null); 14*83a54b2fSSadaf Ebrahimi stylesheet = document.implementation.createDocument("", "", null); 15*83a54b2fSSadaf Ebrahimi if (xmlFile.load){ 16*83a54b2fSSadaf Ebrahimi xmlFile.load("site.xml"); 17*83a54b2fSSadaf Ebrahimi stylesheet.load("web/site.xsl"); 18*83a54b2fSSadaf Ebrahimi } else { 19*83a54b2fSSadaf Ebrahimi alert("Document could not be loaded by browser."); 20*83a54b2fSSadaf Ebrahimi } 21*83a54b2fSSadaf Ebrahimi xmlFile.addEventListener("load", transform, false); 22*83a54b2fSSadaf Ebrahimi stylesheet.addEventListener("load", transform, false); 23*83a54b2fSSadaf Ebrahimi } 24*83a54b2fSSadaf Ebrahimi //IE 6.0+ solution 25*83a54b2fSSadaf Ebrahimi else if (window.ActiveXObject) { 26*83a54b2fSSadaf Ebrahimi xmlFile = new ActiveXObject("msxml2.DOMDocument.3.0"); 27*83a54b2fSSadaf Ebrahimi xmlFile.async = false; 28*83a54b2fSSadaf Ebrahimi xmlFile.load("site.xml"); 29*83a54b2fSSadaf Ebrahimi stylesheet = new ActiveXObject("msxml2.FreeThreadedDOMDocument.3.0"); 30*83a54b2fSSadaf Ebrahimi stylesheet.async = false; 31*83a54b2fSSadaf Ebrahimi stylesheet.load("web/site.xsl"); 32*83a54b2fSSadaf Ebrahimi cache = new ActiveXObject("msxml2.XSLTemplate.3.0"); 33*83a54b2fSSadaf Ebrahimi cache.stylesheet = stylesheet; 34*83a54b2fSSadaf Ebrahimi transformData(); 35*83a54b2fSSadaf Ebrahimi } 36*83a54b2fSSadaf Ebrahimi } 37*83a54b2fSSadaf Ebrahimi // separate transformation function for IE 6.0+ 38*83a54b2fSSadaf Ebrahimi function transformData(){ 39*83a54b2fSSadaf Ebrahimi var processor = cache.createProcessor(); 40*83a54b2fSSadaf Ebrahimi processor.input = xmlFile; 41*83a54b2fSSadaf Ebrahimi processor.transform(); 42*83a54b2fSSadaf Ebrahimi data.innerHTML = processor.output; 43*83a54b2fSSadaf Ebrahimi } 44*83a54b2fSSadaf Ebrahimi // separate transformation function for NSCP 7.1+ and Mozilla 1.4.1+ 45*83a54b2fSSadaf Ebrahimi function transform(){ 46*83a54b2fSSadaf Ebrahimi returnval+=1; 47*83a54b2fSSadaf Ebrahimi if (returnval==2){ 48*83a54b2fSSadaf Ebrahimi var processor = new XSLTProcessor(); 49*83a54b2fSSadaf Ebrahimi processor.importStylesheet(stylesheet); 50*83a54b2fSSadaf Ebrahimi doc = processor.transformToDocument(xmlFile); 51*83a54b2fSSadaf Ebrahimi document.getElementById("data").innerHTML = doc.documentElement.innerHTML; 52*83a54b2fSSadaf Ebrahimi } 53*83a54b2fSSadaf Ebrahimi } 54*83a54b2fSSadaf Ebrahimi</script> 55*83a54b2fSSadaf Ebrahimi</head> 56*83a54b2fSSadaf Ebrahimi<body onload="init();"> 57*83a54b2fSSadaf Ebrahimi<!--[insert static HTML here]--> 58*83a54b2fSSadaf Ebrahimi<div id="data"><!-- this is where the transformed data goes --></div> 59*83a54b2fSSadaf Ebrahimi</body> 60*83a54b2fSSadaf Ebrahimi</html> 61