Share via


Perform XSL Transformations (Visual Basic)

 

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.frm Visual Basic 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 Visual Basic Project

  1. Create a Visual Basic project and set a reference to MSXML 5.0 for Microsoft Office Applications. For detailed instructions on how to do this, see Set Up My Visual Basic Project.

  2. Name the project XSLTProj.

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