xsl-list
[Top] [All Lists]

Re: [xsl] [xslt 2.0] Local functions

2007-07-19 18:00:00
Michael Kay:
Generally speaking, I think functions local to a function (or template) are
not an especially good idea ...

Dimitre Novatchev:
As the need for local functions has never been expressed in this list
for a period of 7 years, ...

Thanks guys, that was just the informed type of feedback I was seeking.

Michael Kay:
Anonymous functions would be a different question, if we had support
for higher-order functions in the language.

Dimitre Novatchev:
Having higher order functions (as provided by FXSL) eliminates the
need for local functions. One can even create functions dynamically
(by composition or by currying).

Dimitre, other than by composition or by currying, does FXSL support
arbitrary anonymous functions.

I've tossed a poor man's lambda into my library which ends up
calling saxon:evaluate().  Usage is something like this

s:map( s:l( 'some xpath expression which can operate on $p1'),
$sequence-of-values-id-like-to-translate-into-something-else)

e.g.

s:map( s:l( '$p1 * 2"),  $x)

returns $x with all values in the sequence doubled.

Yes, you could do that in FXSL by currying.


Justin Johansson
Now a Schema-Aware XSLT Evangelist

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>