topical media & game development

talk show tell print

professional-javascript-15-IEXsltExample4.htm / htm



  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  
  <html>
      <head>
          <title>IE XSLT Example</title>   
          <script type="text/javascript" src="detect.js"></script>
          <script type="text/javascript" src="xmldom.js"></script>
          <script type="text/javascript">
              window.onload = function () {
                  var oXmlDom = new XmlDom();
                  var oXslDom = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
                  
                  oXmlDom.load("employees.xml");
                  oXslDom.load("employees3.xslt");
                  
                  var oTemplate = new ActiveXObject("Msxml2.XSLTemplate");
                  oTemplate.stylesheet = oXslDom;
                  
                  var oProcessor = oTemplate.createProcessor();
                  oProcessor.input = oXmlDom;
                  oProcessor.addParameter("message", "Hello World!");                
                  oProcessor.transform();                
  
                  var oDiv = document.getElementById("divResult");
                  oDiv.innerHTML = oProcessor.output;
                  
        
  
              }
          </script>           
      </head>
      <body>
          <p>This example loads employees.xml and transforms it using employees3.xslt. 
          The parameter <code>message</code> is passed in and is equal to &quot;Hello
          World!&quot;. No start mode is passed in, so the employee's name is first and
          the position is second. The resulting code is then displayed.</p>
          <div id="divResult"></div>
      </body>
  </html>
  


(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.