.NET Framework 2.0 augments the XSLT support provided by the .NET Framework 1.x by providing a very rich and powerful set of XML classes that allow the developers to easily tap into XML and XSLT in their applications. Although .NET 1.x provided built-in support for transforming XML documents using XSLT, .NET 2.0 provides huge performance gains by introducing new classes to the base class library. |
XSLT uses the XPath language to perform queries on an XML document to select a particular part of the document. You can also use XSLT to transform the existing XML structure into one that can be easily processed. To accomplish this, you use an XSLT processor and an XSLT style sheet (XSLT file) that defines how to carry out the transformation. The classes in the System.Xml.Xsl namespace that are mainly utilized for transforming XML data using an XSLT style sheet are as follows: |
XslCompiledTransform — This class is the new.NET XSLT processor and provides the core |
services for transforming XML data using XSLT style sheet. Its implementation is based on the XML query architecture and this class provides significant performance gains when compared to the obsolete XslTransform class. This class supports the XSLT 1.0 syntax. |
XsltArgumentList —As the name suggests, this class is used to supply values of runtime |
parameters to the XSLT query processor. Runtime parameters are very useful in scenarios wherein you want to utilize the same compiled query multiple times with different parameters. You can also use this class to add a new extension object to the list and associate it with the given namespace. |
XsltException— This class encapsulates the exception that is thrown when an error occurs |
while processing an XSLT transform. |
The XslTransform class used with .NET 1.x is now obsolete in .NET Framework 2.0. The new |
XslCompiledTransform class is the .NET XSLT processor and provides the implementation of the XSLT engine. In addition to the performance improvements, this new class also brings with it a host of new security features. |
Chapter 7 provides an in-depth discussion on transforming XML data using XSLT with .NET classes. |