Subject: What is exciting in XSLT 2.0 (Was: Re: parameters in XSLT 2.0)
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 8 Jun 2005 21:37:29 +1000
|
With the introduction of xsl:function in XSLT 2.0 there are a number
of extremely interesting and important topics that are now becomming
more relevant but (I wonder why), are rarely discussed on this list.
Function overloading -- limitations and how to overcome them.
Parameter typing -- specific vs more general types, polymorhism,
how to determine dynamically the type of an actual argument, passing
functions as parameters.
Function return type -- same as above plus returning a function as
the result, plus non-pure functions.
Sequences -- serialization/deserialization.
Higher-order functions, partial application, controlling the
sequence of evaluation.
Memoisation.
Function libraries (it's a pity we can't have them in compiled form)
Modelling the "continuation-passing" style.
Isn't this breathtaking!
Cheers,
Dimitre Novatchev
On 6/8/05, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> > First, am I right that if I use an "as" attribute of element() or
> > node() I am passing a reference to the original element or node, and
> > thus that this is an efficient operation?
>
> In the examples below you are passing a reference. If you used xsl:copy-of
> rather that xsl:sequence you would be creating a copy.
>
> The effect of using "as" on performance may be positive or negative. It may
> cause the system to do run-time checks that would otherwise not be
> performed. On the other hand, it gives the system compile-time information
> that may be useful to perform optimizations. I would use it as widely as
> possible because it speeds the development cycle and catches bugs more
> efficiently, and not worry too much about any effect on performance.
>
> >
> > Related, am I correct that these below are equivalent from a
> > processing
> > standpoint?
> >
> > <xsl:variable name="foo" select="bar" as="element()"/>
> >
> > <xsl:variable name="foo" as="element()">
> > <xsl:sequence select="bar"/>
> > </xsl:variable>
>
> Yes.
> >
> > Finally, in general, under what conditions should one use tunnel
> > parameters? I do a lot of parameter passing in my
> > stylesheets, though
> > the content of those parameters is typically fixed.
> >
>
> Use them if A calls E via B, C, and D, and you want to get information from
> A to E without cluttering the code of templates B, C, and D. The most
likely
> use-case for this is if you are reusing existing templates B, C, and D and
> want to reuse them unchanged.
>
> Michael Kay
> http://www.saxonica.com/
|