Share via


Perform XSL Transformations (JScript)

 

To perform XSL Transformations (XSLT) using DOM, you need to create at least two XML DOM objects: one for an XML document, and the other for the XSLT style sheet. You can then call the transformNode method on the DOM object for the XML data file, using the DOM object for the XSLT style sheet as input. The transformation outputs a string.

Alternatively, you can call the transformNodeToObject method on the DOM object for the XML data with the style sheet as the input. This transformation outputs another XML DOM object. This exercise demonstrates both ways to perform XSLT.

This tutorial uses or creates the following files:

File Description
Source: XSLT.js JScript source code.
Resource :test.xml and test.xsl An XML data file and an XSLT style sheet.
Output Output from the application.

To create the XSLT JScript project

  1. Create a JScript project. For detailed instructions on how to do this, see Set Up My JScript Project.

  2. Name the project XSLTProj.

Next, we'll add the source code for this project.