XPathDocument Input to XslTransform

XPathDocument Input to XslTransform


The XPathDocument is a read-only cache, for processing documents with XslTransform. It is structurally similar to the XML Document Object Model (DOM), but it is highly optimized for Extensible Stylesheet Language for Transformations (XSLT) processing and the XML Path Language (XPath) data model using the XPath optimization functions on the XPathNavigator.


The XslTransform class is obsolete in the .NET Framework 2.0. You can perform Extensible Stylesheet Language for Transformations (XSLT) transformations using the XslCompiledTransform class. See Using the XslCompiledTransform Class and Migrating From the XslTransform Class for more information.

The following code sample creates an XPathDocument as input to a transform.

XslTransform xslt = new XslTransform();
XPathDocument doc = XPathDocument("books.xml");
StringWriter fs = new StringWriter();
Xslt.Transform(doc, null, fs, null);
© 2016 Microsoft