Inputs to the XslCompiledTransform Class 

The Transform method accepts three input types for the source document: an object that implements the IXPathNavigable interface, an XmlReader object that reads the source document, or a string URI.

Note

The XslCompiledTransform class preserves white space by default. This is in accordance with section 3.4 of the W3C XSLT 1.0 recommendation (section 3.4, https://www.w3.org/TR/xslt.html#strip).

IXPathNavigable Interface

The IXPathNavigable interface is implemented in the XmlNode and XPathDocument classes. These classes represent an in-memory cache of XML data.

  • The XmlNode class is based on the W3C Document Object Model (DOM) and includes editing capabilities.

  • The XPathDocument class is a read-only data store based on the XPath data model. XPathDocument is the recommended class for XSLT processing. It provides faster performance when compared to the XmlNode class.

Note

Transformations apply to the document as a whole. In other words, if you pass in a node other than the document root node, this does not prevent the transformation process from accessing all nodes in the loaded document. To transform a node fragment, you must create an object containing just the node fragment, and pass that object to the Transform method. For more information, see How to: Transform a Node Fragment.

XmlReader Object

The Transform method loads from the current node of the XmlReader through all its children. This enables you to use a portion of a document as the context document. After the Transform method returns, the XmlReader is positioned on the next node after the end of the context document. If the end of the document is reached, the XmlReader is positioned at the end of file (EOF).

String URI

You can also specify the source document URI as your XSLT input. An XmlResolver is used to resolve the URI. You can specify the XmlResolver to use by passing it to the Transform method. If an XmlResolver is not specified, the Transform method uses a default XmlUrlResolver with no credentials.

For more information, see Resolving External Resources During XSLT Processing.

See Also

Other Resources

XSLT Transformations