This documentation is archived and is not being maintained.

XslTransform.Transform Method

Transforms the XML data using the loaded XSLT stylesheet.

Note   If you are upgrading from .NET Framework version 1.0, see XslTransform Class Implements the XSLT Processor for migration information.

Overload List

Obsolete. Transforms the XML data in the IXPathNavigable using the specified args and outputs the result to an XmlReader.

[Visual Basic] Overloads Public Function Transform(IXPathNavigable, XsltArgumentList) As XmlReader
[C#] public XmlReader Transform(IXPathNavigable, XsltArgumentList);
[C++] public: XmlReader* Transform(IXPathNavigable*, XsltArgumentList*);
[JScript] public function Transform(IXPathNavigable, XsltArgumentList) : XmlReader;

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

[Visual Basic] Overloads Public Sub Transform(String, String)
[C#] public void Transform(string, string);
[C++] public: void Transform(String*, String*);
[JScript] public function Transform(String, String);

Obsolete. Transforms the XML data in the XPathNavigator using the specified args and outputs the result to an XmlReader.

[Visual Basic] Overloads Public Function Transform(XPathNavigator, XsltArgumentList) As XmlReader
[C#] public XmlReader Transform(XPathNavigator, XsltArgumentList);
[C++] public: XmlReader* Transform(XPathNavigator*, XsltArgumentList*);
[JScript] public function Transform(XPathNavigator, XsltArgumentList) : XmlReader;

Obsolete. Transforms the XML data in the IXPathNavigable using the specified args and outputs the result to a Stream.

[Visual Basic] Overloads Public Sub Transform(IXPathNavigable, XsltArgumentList, Stream)
[C#] public void Transform(IXPathNavigable, XsltArgumentList, Stream);
[C++] public: void Transform(IXPathNavigable*, XsltArgumentList*, Stream*);
[JScript] public function Transform(IXPathNavigable, XsltArgumentList, Stream);

Obsolete. Transforms the XML data in the IXPathNavigable using the specified args and outputs the result to a TextWriter.

[Visual Basic] Overloads Public Sub Transform(IXPathNavigable, XsltArgumentList, TextWriter)
[C#] public void Transform(IXPathNavigable, XsltArgumentList, TextWriter);
[C++] public: void Transform(IXPathNavigable*, XsltArgumentList*, TextWriter*);
[JScript] public function Transform(IXPathNavigable, XsltArgumentList, TextWriter);

Transforms the XML data in the IXPathNavigable using the specified args and outputs the result to an XmlReader.

[Visual Basic] Overloads Public Function Transform(IXPathNavigable, XsltArgumentList, XmlResolver) As XmlReader
[C#] public XmlReader Transform(IXPathNavigable, XsltArgumentList, XmlResolver);
[C++] public: XmlReader* Transform(IXPathNavigable*, XsltArgumentList*, XmlResolver*);
[JScript] public function Transform(IXPathNavigable, XsltArgumentList, XmlResolver) : XmlReader;

Obsolete. Transforms the XML data in the IXPathNavigable using the specified args and outputs the result to an XmlWriter.

[Visual Basic] Overloads Public Sub Transform(IXPathNavigable, XsltArgumentList, XmlWriter)
[C#] public void Transform(IXPathNavigable, XsltArgumentList, XmlWriter);
[C++] public: void Transform(IXPathNavigable*, XsltArgumentList*, XmlWriter*);
[JScript] public function Transform(IXPathNavigable, XsltArgumentList, XmlWriter);

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

[Visual Basic] Overloads Public Sub Transform(String, String, XmlResolver)
[C#] public void Transform(string, string, XmlResolver);
[C++] public: void Transform(String*, String*, XmlResolver*);
[JScript] public function Transform(String, String, XmlResolver);

Obsolete. Transforms the XML data in the XPathNavigator using the specified args and outputs the result to a Stream.

[Visual Basic] Overloads Public Sub Transform(XPathNavigator, XsltArgumentList, Stream)
[C#] public void Transform(XPathNavigator, XsltArgumentList, Stream);
[C++] public: void Transform(XPathNavigator*, XsltArgumentList*, Stream*);
[JScript] public function Transform(XPathNavigator, XsltArgumentList, Stream);

Obsolete. Transforms the XML data in the XPathNavigator using the specified args and outputs the result to a TextWriter.

[Visual Basic] Overloads Public Sub Transform(XPathNavigator, XsltArgumentList, TextWriter)
[C#] public void Transform(XPathNavigator, XsltArgumentList, TextWriter);
[C++] public: void Transform(XPathNavigator*, XsltArgumentList*, TextWriter*);
[JScript] public function Transform(XPathNavigator, XsltArgumentList, TextWriter);

Transforms the XML data in the XPathNavigator using the specified args and outputs the result to an XmlReader.

[Visual Basic] Overloads Public Function Transform(XPathNavigator, XsltArgumentList, XmlResolver) As XmlReader
[C#] public XmlReader Transform(XPathNavigator, XsltArgumentList, XmlResolver);
[C++] public: XmlReader* Transform(XPathNavigator*, XsltArgumentList*, XmlResolver*);
[JScript] public function Transform(XPathNavigator, XsltArgumentList, XmlResolver) : XmlReader;

Obsolete. Transforms the XML data in the XPathNavigator using the specified args and outputs the result to an XmlWriter.

[Visual Basic] Overloads Public Sub Transform(XPathNavigator, XsltArgumentList, XmlWriter)
[C#] public void Transform(XPathNavigator, XsltArgumentList, XmlWriter);
[C++] public: void Transform(XPathNavigator*, XsltArgumentList*, XmlWriter*);
[JScript] public function Transform(XPathNavigator, XsltArgumentList, XmlWriter);

Transforms the XML data in the IXPathNavigable using the specified args and outputs the result to a Stream.

[Visual Basic] Overloads Public Sub Transform(IXPathNavigable, XsltArgumentList, Stream, XmlResolver)
[C#] public void Transform(IXPathNavigable, XsltArgumentList, Stream, XmlResolver);
[C++] public: void Transform(IXPathNavigable*, XsltArgumentList*, Stream*, XmlResolver*);
[JScript] public function Transform(IXPathNavigable, XsltArgumentList, Stream, XmlResolver);

Transforms the XML data in the IXPathNavigable using the specified args and outputs the result to a TextWriter.

[Visual Basic] Overloads Public Sub Transform(IXPathNavigable, XsltArgumentList, TextWriter, XmlResolver)
[C#] public void Transform(IXPathNavigable, XsltArgumentList, TextWriter, XmlResolver);
[C++] public: void Transform(IXPathNavigable*, XsltArgumentList*, TextWriter*, XmlResolver*);
[JScript] public function Transform(IXPathNavigable, XsltArgumentList, TextWriter, XmlResolver);

Transforms the XML data in the IXPathNavigable using the specified args and outputs the result to an XmlWriter.

[Visual Basic] Overloads Public Sub Transform(IXPathNavigable, XsltArgumentList, XmlWriter, XmlResolver)
[C#] public void Transform(IXPathNavigable, XsltArgumentList, XmlWriter, XmlResolver);
[C++] public: void Transform(IXPathNavigable*, XsltArgumentList*, XmlWriter*, XmlResolver*);
[JScript] public function Transform(IXPathNavigable, XsltArgumentList, XmlWriter, XmlResolver);

Transforms the XML data in the XPathNavigator using the specified args and outputs the result to a Stream.

[Visual Basic] Overloads Public Sub Transform(XPathNavigator, XsltArgumentList, Stream, XmlResolver)
[C#] public void Transform(XPathNavigator, XsltArgumentList, Stream, XmlResolver);
[C++] public: void Transform(XPathNavigator*, XsltArgumentList*, Stream*, XmlResolver*);
[JScript] public function Transform(XPathNavigator, XsltArgumentList, Stream, XmlResolver);

Transforms the XML data in the XPathNavigator using the specified args and outputs the result to a TextWriter.

[Visual Basic] Overloads Public Sub Transform(XPathNavigator, XsltArgumentList, TextWriter, XmlResolver)
[C#] public void Transform(XPathNavigator, XsltArgumentList, TextWriter, XmlResolver);
[C++] public: void Transform(XPathNavigator*, XsltArgumentList*, TextWriter*, XmlResolver*);
[JScript] public function Transform(XPathNavigator, XsltArgumentList, TextWriter, XmlResolver);

Transforms the XML data in the XPathNavigator using the specified args and outputs the result to an XmlWriter.

[Visual Basic] Overloads Public Sub Transform(XPathNavigator, XsltArgumentList, XmlWriter, XmlResolver)
[C#] public void Transform(XPathNavigator, XsltArgumentList, XmlWriter, XmlResolver);
[C++] public: void Transform(XPathNavigator*, XsltArgumentList*, XmlWriter*, XmlResolver*);
[JScript] public function Transform(XPathNavigator, XsltArgumentList, XmlWriter, XmlResolver);

Example

[Visual Basic, C#, C++] The following example loads an edits an XML document before performing an XSLT transform.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of Transform. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Dim doc as XmlDocument = new XmlDocument()
doc.Load("books.xml")

' Modify the XML file.
Dim root as XmlElement = doc.DocumentElement
root.FirstChild.LastChild.InnerText = "12.95"

' Create an XPathNavigator to use for the transform.
Dim nav as XPathNavigator = root.CreateNavigator()

' Transform the file.
Dim xslt as XslTransform = new XslTransform()
xslt.Load("output.xsl")
Dim writer as XmlTextWriter = new XmlTextWriter("books.html", nothing)
xslt.Transform(nav,nothing, writer, nothing)

[C#] 
XmlDocument doc = new XmlDocument();
doc.Load("books.xml");

// Modify the XML file.
XmlElement root = doc.DocumentElement;
root.FirstChild.LastChild.InnerText = "12.95";

// Create an XPathNavigator to use for the transform.
XPathNavigator nav = root.CreateNavigator();

// Transform the file.
XslTransform xslt = new XslTransform();
xslt.Load("output.xsl");
XmlTextWriter writer = new XmlTextWriter("books.html", null);
xslt.Transform(nav, null, writer, null);

[C++] 
XmlDocument* doc = new XmlDocument();
doc -> Load(S"books.xml");

// Modify the XML file.
XmlElement * root = doc -> DocumentElement;
root -> FirstChild -> LastChild -> InnerText = S"12.95";

// Create an XPathNavigator to use for the transform.
XPathNavigator * nav = root -> CreateNavigator();

// Transform the file.
XslTransform* xslt = new XslTransform();
xslt -> Load(S"output.xsl");
XmlTextWriter* writer = new XmlTextWriter(S"books.html", 0);
xslt -> Transform(nav, 0, writer, 0);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

XslTransform Class | XslTransform Members | System.Xml.Xsl Namespace

Show: