xsl-list
[Top] [All Lists]

RE: parameter default for xsl:function?

2006-02-26 10:13:06
User-defined functions are designed to be context-free: all arguments have
to be passed explicitly, and they have no access to the context item at the
point of the call. In this sense they differ from system-defined functions
like name() and position().

The reason for this is to allow optimizations of the kind that are common in
functional programming languages. It is a bit inconsistent though.

Thanks for the nice words about Saxon.

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: Joern Nettingsmeier [mailto:nettings(_at_)folkwang-hochschule(_dot_)de] 
Sent: 26 February 2006 16:41
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] parameter default for xsl:function?

hi!


i'm playing around with xsl 2.0 atm, and i'm wondering: is it 
possible 
to define functions that operate on a node in such a way that they 
default to the current one if the parameter list is empty?

"current()" inside a function is not the way to do it, since saxon 
complains that there is no context item defined at this point, which 
sounds convincing ;)

i remember reading in the spec that both polymorphism and 
variable-length argument lists are not supported, but i 
wonder: how do 
the internal xpath 1.0 functions do it? e.g.:

concat(<string>, <string> [,<string>]+)

name([<node>])


btw, xsl 2 is really a huge improvement, thanks a bunch to all 
contributors, and to dr. kay for the saxon implementation!


regards,


jörn



-- 
jörn nettingsmeier

home://germany/45128 essen/lortzingstr. 11/
http://spunk.dnsalias.org
phone://+49/201/491621

if you are a free (as in "free speech") software developer
and you happen to be travelling near my home, drop me a line
and come round for a free (as in "free beer") beer. :-D

--~------------------------------------------------------------------
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>
--~--





--~------------------------------------------------------------------
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>