Perform XSL Transformations (C/C++)

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Developer's Guide

Perform XSL Transformations (C/C++)

In general, performing XSL Transformations (XSLT) requires two DOM objects: one for the XML data file, and one for the XSLT style sheet. It also involves calling either the transformNode method or the transformNodeToObject method on the DOM object that corresponds to the XML data. The DOM object holding the XSLT style sheet is the input for the method. The first method returns the result as a string, and the second method returns the result as an object.

In the following C/C++ Win32 Console Application project, we demonstrate how to do this. The XSLT project uses or creates the following files.

Component Description
Source: XSLT.cpp Transforms an XML data file with an XSLT style sheet.
Resource: stocks.xml and stocks.xsl An XML data file and an XSLT style sheet.
Output When you build and run the XSLT project, you should get this output in a console window.

To create the XSLT project in Visual C++

  • Create a Win32 console application in Visual C++. For detailed instructions on how to do this, see Set Up My Visual C++ Project. Name the project XSLTProj.

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