Compartilhar via


Using XSLT with the DOM

 

MSXML uses the DOM as the underlying tree representation of XML documents and XSLT style sheets. This enables you to implement XSLT solutions by manipulating the DOM objects in a script, or in a COM-enabled programming language. To do this, you must perform the following tasks:

  • Load the source document and the XSLT file into DOM instances.

  • Apply the transformation by calling either the transformNode method or the transformNodeToObject method on the source document object. Set the style sheet object as the input parameter.

The following are some of the advantages of using XSLT with the DOM.

  • You can select a specified version of the XSLT run-time library with version-dependent ProgIDs.

  • You can use the built-in error-detection and reporting mechanism of the DOM for exception handling in XSLT.

  • You can reduce the overhead of an iterative XSLT process by compiling and caching the style sheet into an XSLTemplate object.

The following topics discuss the use of XSLT with the DOM. JScript examples are included.