Version 1.1 of the .NET platform sports a slightly different XslTransform object with more secure Load() and Transform() methods. Many of the overloaded versions of the Transform() method from version 1.0 of .NET are now considered to be obsolete. If you take a closer look at the Transform() method (in the documentation for version 1.1 of the framework) you’ll see that the new overloads expect you to pass an instance of an XmlResolver. An example of one of these overloads is shown below:

This a little confusing for some because XmlResolver is an abstract class that cannot be created directly. However, a class named XmlUrlResolver derives from XmlResolver and can be instantiated using the familiar “new” keyword in VB.NET or C#. In cases where basic XSLT transformations (transformations that involve a single XML document) must be performed, a null (Nothing in VB.NET) can be passed for the XmlResolver parameter as shown below:

Passing null for the XmlResolver parameter when more than one XML document is involved in the transformation presents a problem. If you need to use the document() function to transform multiple XML documents simultaneously, then passing a null will cause these external documents to be ignored. The demo code for this sample application demonstrates how to properly call the Transform() method of the XslTransform class when the document() function must be used to transform multiple XML documents.