topical media & game development

talk show tell print

#ajax-xsl.cfg / cfg



  <span id=info-@qid></span>
  <script type="text/javascript">
  if (window.ActiveXObject) { // IE
  // Load XML 
  var xml@qid = new ActiveXObject("Microsoft.XMLDOM")
  xml@qid.async = false
  xml@qid.load("@xml")
  
  // Load XSL
  var xsl@qid = new ActiveXObject("Microsoft.XMLDOM")
  xsl@qid.async = false
  xsl@qid.load("@xsl")
  
  // Transform
  document.write(xml@qid.transformNode(xsl@qid))
  
  }
  else if (document.implementation && document.implementation.createDocument) { // Ff
  var xmlhttp@qid = new XMLHttpRequest();
  
  // Retrieve XML
  xmlhttp@qid.open("GET", "@xml", false);
  xmlhttp@qid.send(null);
  var xmlDoc@qid = xmlhttp@qid.responseXML;
  
  // Retrieve XSL
  xmlhttp@qid.open("GET", "@xsl", false);
  xmlhttp@qid.send(null);
  var xslDoc@qid = xmlhttp@qid.responseXML;
  
  // Set up XSLT processor
  var xslProc@qid = new XSLTProcessor();
  xslProc@qid.importStylesheet(xslDoc@qid);
  
  // Do the transformation
  var fragment@qid = xslProc@qid.transformToFragment(xmlDoc@qid, document);
  //document.write(fragment);
  // Insert it into the HTML somewhere
  //document.getElementsByTagName("body")[0].appendChild(fragment);
  document.getElementsByTagName("span")["info-@qid"].appendChild(fragment@qid);
  } 
  </script>


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.