XSLT Functions in XSLT (Was: Re: [xsl] XSLT 1.1 comments)

Subject: XSLT Functions in XSLT (Was: Re: [xsl] XSLT 1.1 comments)
From: "Steve Muench" <Steve.Muench@xxxxxxxxxx>
Date: Tue, 13 Feb 2001 12:42:42 -0800
| > | I also like the idea expressed here of implementing extension
| > | functions in XSLT.
| > 
| > So do I. See Michael Kay's <saxon:function> extension
| > element for one idea of the shape that extension functions
| > in XSLT might take.
| > 
| <saxon:function> looks just right, now I've looked it up.

Some of the issues to think about on "Extension Functions in XSLT"...

Some folks see this as sugar syntax for an <xsl:call-template>.
That is, instead of doing:

      <xsl:call-template name="my:foo">
        <xsl:with-param name="bar" select="5"/>
        <xsl:with-param name="baz" select="'boop'"/>

You write instead something like:

<SomeElement><xsl:value-of select="my:foo(5,'boop')"/></SomeElement>


<SomeElement><xsl:copy-of select="my:foo(5,'boop')"/></SomeElement>

This would mean that a function implemented in XSLT could
only return the same kind of thing that a template can
instantiate, that is, a result-tree-fragment.

Others see the potential to be more powerful, allowing
the extension function returned in XSLT to return any
kind of supported XPath expression of any type in
the XSLT datamodel (XPath + ResultTreeFrag + External Object).
This is the approach that <saxon:function> and it's 
<saxon:return> allow.

Allowing XSLT-implemented functions to be more powerful
than templates in this way, makes some folks think that
it is a move in the direction of making XSLT more into
a programming language, when there are already lots of
good general programming languages available. These are
the folks that are fans of user-written extensions, letting
XSLT be good for what it's good for, and letting 
external programming languages fill in when XSLT needs
a helping hand to accomplish a task that's easier to
do in a programming language.

These are some of the issues that the XSL WG is working on
tackling for XSLT 2.0. 

Steve Muench, Lead XML Evangelist & Consulting Product Manager
BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
Author "Building Oracle XML Applications", O'Reilly

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread