Lambda the Ultimate

inactiveTopic EXSLT: Enhancing the Power of XSLT
started 5/28/2003; 5:36:31 AM - last post 5/28/2003; 5:36:31 AM
Ehud Lamm - EXSLT: Enhancing the Power of XSLT  blueArrow
5/28/2003; 5:36:31 AM (reads: 1008, responses: 0)
EXSLT: Enhancing the Power of XSLT
The System.Xml.Xsl.XslTransform class provides two primary mechanisms for creating user-defined functions. XSLT stylesheets can contain functions written in C#, Visual Basic .NET or JScript.NET within msxsl:script elements, which can then be invoked from within the stylesheet just as if they were regular XSLT functions. Another approach is to use XSLT extension objects. Extension objects are regular objects whose public methods are accessible from a stylesheet once the objects are added to the XslTransform class through the AddExtensionObject() method.

Yet another example of language extension.

The article gives examples showing the benefits of extending the language, prior to spending time on solving the specific problem at hand.

One quote that is sure to make many LtU readers happy:

One thing to note about creating extension functions is that XSLT was designed to be a functional programming language, meaning that function calls are not intended to have side effects. This means that to preserve the semantics of XSLT, one should avoid creating extension functions that cause side effects by modifying the state of either the arguments passed to it or other external objects. A good rule of thumb in designing XSLT extension functions is that the same input should always produce the same output.

Posted to xml by Ehud Lamm on 5/28/03; 5:38:45 AM