Subject: RE: mapping (Was: Re: Re: . in for)
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Tue, 8 Jan 2002 02:51:39 -0800 (PST)
|
DPawson at rnib dot org dot uk wrote:
> Jeni wrote
> > > This example could be handled with a mapping operator:
> > >
> > > <xsl:variable name="emps"
> > > select="//employee[@dept = ($departments -> lower-case(.))]" />
>
> +1 on mapping, but I dislike the above syntax Jeni.
> Scheme gives (map fn sequence).
>
> How about
>
> select='map lower-case(.) $departments'/>
> or
> select='map (lower-case(.) $departments)'/>
>
> or does this go against the idea of extending keywords?
In both cases lower-case(.) is a value and not a function. The map function requires
a function as an argument as in:
select='map (lower-case(), $departments)'/>
This would be possible if the XPath 2.0 WG decides for higher-order function support
in XPath 2.0.
Many people already support this idea. A language with higher-order functions can be
simple and powerful, as this is described in:
"Higher-order function support as means to reduce the "standard"
operators/functions. "
http://aspn.activestate.com/ASPN/Mail/Message/xsl-list/967679
Cheers,
Dimitre Novatchev.
__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|