XML Transform Sample

Sample Overview

This sample illustrates how to apply an Extensible Stylesheet Language Transformation (XSLT) file to an XML document using the XslTransform class.

This sample consists of a method, ReadTransformWrite, with two sections. The first part of the method simply reads an XML document and then transforms the data using an XSLT file. The second part reads an XML document, transforms the data, and then writes a new XML document from the transformed data.

The sample applies this method to three sets of documents:

Sample Source and Build Output Locations

The sample source is found in sscli\samples\howto\xml\xmltransform.

The source file is:

The other support files for this sample are:

The build output location is %TARGETCOMPLUS%\samples\xml\xmltransform.  The output file is an executable assembly named xmltransform.exe.

Building the Sample

All samples are built from the buildall script. 

You can also build all the samples by switching to the root of the sample directory, sscli\samples, and typing build -c.

You can build this specific sample by switching to the sample directory and typing build -c.

Running the Sample

These steps require that the Shared Source CLI (SSCLI) be already built and functional.

  1. Run env.bat or source the env.csh or env.sh script files, depending on your platform.
  2. Switch to the %TARGETCOMPLUS%\samples\xml\xmltransform directory.
  3. Type the following command:

    clix xmltransform.exe

When the sample runs, several transformed XML files are generated:


Copyright (c) 2002 Microsoft Corporation. All rights reserved.