XPathDocument Input to XslTransform

The XPathDocument is a read-only cache, for processing documents with XslTransform. It is structurally similar to the XML DOM, but it is highly optimized for XSLT processing and the XPath data model using the XPath optimization functions on the XPathNavigator.

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

Dim xslt as XslTransform = new XslTransform()
Xslt.Load(someStylesheet)
Dim doc as XPathDocument = New XPathDocument("books.xml")
Dim fs as StringWriter = new StringWriter()
Xslt.Transform(doc, Nothing, fs, Nothing);
[C#]
XslTransform xslt = new XslTransform();
Xslt.Load(someStylesheet);
XPathDocument doc = XPathDocument("books.xml");
StringWriter fs = new StringWriter();
Xslt.Transform(doc, null, fs, null);

See Also

XslTransform Class Implements the XSLT Processor