Microsoft XML 2.5 SDK


 

transformNodeToObject Method

[This is preliminary documentation and subject to change.]

Processes this node and its children using the supplied XSL style sheet, and returns the resulting transformation in the supplied object.

Syntax

obj.transformNodeToObject(stylesheet, outputObject);

Parameters

stylesheet

Object. Valid XML document or DOM node, which consists of XSL elements that direct the transformation of this node.

outputObject

Object. On return, contains the product of the transformation of this XML document based on the XSL style sheet. If the variant represents the XMLDOMDocument object, the document is built according to its properties, and its child nodes are replaced during this transformation process. The XML transformation can also be sent to a stream.

Example

This example sets up the new XML Document object called "result" before making the call to transformNodeToObject.

<SCRIPT>
  // load data
  var source = new ActiveXObject("Microsoft.XMLDOM");
  source.async = false
  source.load("data.xml");
 
  // load style sheet
  var stylesheet = new ActiveXObject("Microsoft.XMLDOM");
  stylesheet.async = false
  stylesheet.load("style.xsl");
 
  // set up the resulting document
  var result = new ActiveXObject("Microsoft.XMLDOM");
  result.async = false
  result.validateOnParse = true;
 
  // parse results into a result DOM Document
  source.transformNodeToObject(stylesheet, result); 
</SCRIPT>

Remarks

The stylesheet parameter must be either an XMLDOMDocument node, in which case the document is assumed to be an XSL style sheet, or a DOM node in the XSL stylesheet, in which case this node is treated as a standalone style sheet fragment.

The source node defines a context for the stylesheet to operate on, but navigation outside this scope is allowed. For instance, a stylesheet could use the ancestor or id methods to access other parts of the document.

This method supports both standalone and embedded style sheets, and additionally provides the ability to run a localized style sheet fragment against a particular source node.

For more information about XSL, see the XSL Reference.

This member is an extension of the W3C DOM.

Applies To

XMLDOMAttribute, XMLDOMCDATASection, XMLDOMCharacterData, XMLDOMComment, XMLDOMDocument, XMLDOMDocumentFragment, XMLDOMDocumentType, XMLDOMElement, XMLDOMEntity, XMLDOMEntityReference, XMLDOMNode, XMLDOMNotation, XMLDOMProcessingInstruction, XMLDOMText, XTLRuntime

See Also

Using the XSL Processor