The xsl:namespace element is most often useful if namespaces are created dynamically or if they are part of content of elements and attributes as QNames, or if we for cosmetic reasons want to transfer namespace declarations from inner elements to outer element in output.
In XSLT we can use the functions element-available() and function-available() to see what instruction elements and functions are available including extensions. I have made an XSLT stylesheet testing the availability of all XSLT instruction elements, XSLT and XPath functions and Saxon and EXSLT extensions.
XSLT 2.0 became standard in 2007 and we want to use it in ASP.NET. Microsoft has not made an XSLT 2.0 processor yet, but who really cares. It is easy to use the .net version of the Saxon XSLT 2.0 processor instead. This is a tutorial to get you started.
The traditional identity template has several shortcomings. The most important are that XML declaration and DTD are not recreated and that default attributes found in DTD are copied to the output. In XSLT 2.0, using saxon-parse() and saxon-serialize(), it is possible to supplement the identity template with extra templates and instructions overcoming all limits and inconveniences.
In XSLT 2.0 we have 130 functions but we don't have a function to return the line-number of an element node. It is a challenging exercise to make a user-defined function for line-number. We need to get a lot of the new stuff in XSLT 2.0 working, like sequences, unparsed text and Regular Expressions.
Collection() is a non-standardized standard function. It can be used as a better version of document() and doc() with wild cards and Regular Expressions to load a collection of XML documents. Or it can use a catalog file.
The xsl:strip-space and xsl:preserve-space elements are only relevant for whitespace-only text nodes. Some XSLT processors have not even implemented these elements but strip such nodes themselves.
In XSLT 2.0 we can use the unparsed-text() function to test the XML declaration and the DOCTYPE declaration. We can read the pseudo-attributes of the XML declaration and the values of PUBLIC or SYSTEM in the DTD in order to recreate or modify them as we please.
This element syntax summary is an enhanced and a more user-friendly version of the syntax summary in the XSLT 1.0 Recommendation. The headings link to the spec for additionel information.
The so-called identity template that copies everything from input.xml to output.xml, element for element, attribute for attribute, is the most important of all templates in combination with templates of exceptions.
Updated 2009-03-02