XslCompiledTransform.Transform Method (String, String)
Executes the transform using the input document specified by the URI and outputs the results to a file.
Assembly: System.Xml (in System.Xml.dll)
The inputUri or resultsFile value is null.
There was an error executing the XSLT transform.
The input document cannot be found.
The inputUri or resultsFile value includes a filename or directory cannot be found.
The inputUri or resultsFile value cannot be resolved.
An error occurred while processing the request
inputUri or resultsFile is not a valid URI.
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");
The sample uses the following two input files:
Available since 2.0