The transformNodeToObject method provides a way to generate a new DOM document instead of XML text. In this example, data islands are used to load the XML source and the XSL style sheet, and an empty data island is created that will hold the results of the transformation.
<HTML> <SCRIPT FOR="window" EVENT="onload"> data.transformNodeToObject(ss.XMLDocument, resultTree.XMLDocument); </SCRIPT> <XML id="data" src="portfolio.xml"></XML> <XML id="ss" src="portfolio.xsl"></XML> <XML id="resultTree"></XML> </HTML>
Like the transformNode method, the transformNodeToObject method is applied to a node in the source tree, and accepts an XSL style sheet in the form of a DOM tree. A second parameter contains another DOM Document node that will hold the results of the transformation.
Properties set on the output XML DOM Document will be honored during the transformation, such as validateOnParse and async. Any previous children will be deleted during the transformation.
Try it! The above code is a simplification of the Transformation Viewer sample.