December 23, 2001 - Transforming XML to HTML
December 23, 2001 Transforming XML to HTML Tips: December 2001
Yehuda Shiran, Ph.D.
|
ActiveXObject
, then load the XSLT file in separate ActiveXObject
, and then finally transform the XML object to an HTML object. Here is how you load the XML file with the value returned from a Web service (event.result.value
):
var xmldoc = new ActiveXObject("MSXML2.DOMDocument.3.0");
xmldoc.async = false;
xmldoc.loadXML(event.result.value);
and here is how you load the XSLT:
var xsldoc = new ActiveXObject("MXML.DOMDocument.3.0");
xsldoc.asyc = false;
xsldoc.load("./stock.xsl");
and, finally, convert the XML document to an HTML page, and put the result in the variable res
:
res.innerHTML = xmldoc.transformnode(xsldoc);