Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The XSLT architecture has been redesigned in the Microsoft .NET Framework version 2.0 release. The XslTransform class has been replaced by the XslCompiledTransform class.
Performance
The XslCompiledTransform class includes many performance improvements. The new XSLT processor compiles the XSLT style sheet down to a common intermediate format, similar to what the common language runtime (CLR) does for other programming languages. Once the style sheet is compiled, it can be cached and reused.
The XslCompiledTransform class also includes other optimizations that make it much faster than the XslTransform class.
Security
The XslCompiledTransform class disables support for the XSLT document() function and embedded scripting by default. These features can be enabled by creating an XsltSettings object with the features enabled and passing it to the Load method.
For more information, see XSLT Security Considerations.
Migrating Code
The new XSLT classes have been designed to be very similar to the existing classes. The XslCompiledTransform class replaces the XslTransform class. Style sheets are compiled using the Load method. Transforms are executed using the Transform method. The following procedures show common XSLT tasks, and compare the code using the XslTransform class versus the XslCompiledTransform class.
To transform a file and output to a URI
To compile a style sheet and use a resolver with default credentials
To use an XSLT parameter
To enable XSLT scripting
To load the results into a DOM object
Note
The XslCompiledTransform class does not have a method that returns the XSLT transformation results as an XmlReader object. However, you can output to an XML file and load the XML file into another object.