Export (0) Print
Expand All

XslTransform.Transform Method (XPathNavigator, XsltArgumentList, TextWriter)

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

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

public void Transform (
	XPathNavigator input,
	XsltArgumentList args,
	TextWriter output
)
public void Transform (
	XPathNavigator input, 
	XsltArgumentList args, 
	TextWriter output
)
public function Transform (
	input : XPathNavigator, 
	args : XsltArgumentList, 
	output : TextWriter
)

Parameters

input

An XPathNavigator containing the data to be transformed.

args

An XsltArgumentList containing the namespace-qualified arguments used as input to the transformation.

output

The TextWriter to which you want to output.

Exception typeCondition

InvalidOperationException

There was an error processing the XSLT transformation.

Note: This is a change in behavior from earlier versions. An XsltException is thrown if you are using Microsoft .NET Framework version 1.1 or earlier.

NoteNote

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= http://www.w3.org/1999/XSL/Transform.

The args are matched with the xsl:param elements defined in the style sheet. The transformation selections apply to the document as a whole. In other words, if the current node is set on a node tree other than the document root node, this does not prevent the transformation process from accessing all nodes in the loaded document. After the transformation is performed, the XPathNavigator remains in its original state. This means that the node, which is current before the transformation process, remains the current node after the Transform method has been called.

The encoding attribute on an xsl:output element is not supported when outputting to a TextWriter. See Outputs from an XslTransform for specifics on which xsl:output attributes are supported.

NoteNote

This method is now obsolete. The setting of the XmlResolver property determines how the XSLT document() function is resolved. The recommended practice is to use the Transform method which takes an XmlResolver object as one of its arguments.

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, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft