Export (0) Print
Expand All

XslCompiledTransform.Transform Method (String, String)

Note: This method is new in the .NET Framework version 2.0.

Executes the transform using the input document specified by the URI and outputs the results to a file.

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

public void Transform (
	string inputUri,
	string resultsFile
)
public void Transform (
	String inputUri, 
	String resultsFile
)
public function Transform (
	inputUri : String, 
	resultsFile : String
)

Parameters

inputUri

The URI of the input document.

resultsFile

The URI of the output file.

Exception typeCondition

ArgumentNullException

The inputUri or resultsFile value is a null reference (Nothing in Visual Basic).

XsltException

There was an error executing the XSLT transform.

FileNotFoundException

The input document cannot be found.

DirectoryNotFoundException

The inputUri or resultsFile value includes a filename or directory cannot be found.

WebException

The inputUri or resultsFile value cannot be resolved.

-or-

An error occurred while processing the request

UriFormatException

inputUri or resultsFile is not a valid URI.

XmlException

There was a parsing error loading the input document.

This method uses a default XmlUrlResolver with no user credentials to resolve the input and output documents. If any of these resources are located on a network resource that requires authentication, use the overload that takes an XmlResolver as one of its arguments and specify an XmlResolver with the necessary credentials.

An XmlReader with default settings is used to load the input document. DTD processing is disabled on the XmlReader. If you require DTD processing, create an XmlReader with this feature enabled, and pass it to the Transform method.

The following example executes a transform and outputs to a file.

// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("output.xsl");

// Execute the transform and output the results to a file.
xslt.Transform("books.xml", "books.html");

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft