Transform Method (String, String, XmlResolver)

XslTransform.Transform Method (String, String, XmlResolver)


Transforms the XML data in the input file and outputs the result to an output file.

Namespace:   System.Xml.Xsl
Assembly:  System.Xml (in System.Xml.dll)

public void Transform(
	string inputfile,
	string outputfile,
	XmlResolver resolver


Type: System.String

The URL of the source document to be transformed.

Type: System.String

The URL of the output file.

Type: System.Xml.XmlResolver

The XmlResolver used to resolve the XSLT document() function. If this is null, the document() function is not resolved.

The XmlResolver is not cached after the Transform method completes.


The XslTransform class is obsolete in the .NET Framework version 2.0. The XslCompiledTransform class is the new XSLT processor. For more information, see Using the XslCompiledTransform Class and Migrating From the XslTransform Class.

XslTransform supports the XSLT 1.0 syntax. The XSLT style sheet must include the namespace declaration xmlns:xsl=

The following example performs an XSLT transformation and outputs to a file. An XmlUrlResolver with default credentials is used resolve an external resources. See DefaultCredentials for details.

// Create a resolver with default credentials.
XmlUrlResolver resolver = new XmlUrlResolver();
resolver.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Create the XslTransform object.
XslTransform xslt = new XslTransform();

// Load the stylesheet.
xslt.Load("http://myServer/data/authors.xsl", resolver);

// Transform the file.
xslt.Transform("books.xml", "books.html", resolver);

.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft