First page Back Continue Last page Graphics

...Linking to Document


Notes:

This example illustrates how JavaScript can create a DOM tree for a document and a style sheet, then use the latter to transform the former. The transformNode( ) method is proprietary to IE’s implementation of DOM.
<HTML>
<BODY>
<DIV ID="insertHTML"></DIV>
<SCRIPT LANGUAGE=JavaScript>
<!-- Create tree from source document -->
var XMLDoc = new ActiveXObject("MSXML2.DOMDocument.4.0");
XMLDoc.load("schedule.xml");
var XMLDocElem = XMLDoc.documentElement;

<!-- Create tree from style sheet -->
var XSLDoc = new ActiveXObject("MSXML2.DOMDocument.4.0");
XSLDoc.load("schedule.xsl");
var XSLDocElem = XSLDoc.documentElement;

<!-- Apply style sheet to source document -->
result = XMLDocElem.transformNode(XSLDocElem);
insertHTML.innerHTML = result;
</SCRIPT>
</BODY>
</HTML>