[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: mapping (Was: Re: Re: . in for)

Subject: Re: mapping (Was: Re: Re: . in for)
From: Joerg Pietschmann <joerg.pietschmann@xxxxxx>
Date: Thu, 10 Jan 2002 10:37:44 +0100
Re: mapping (Was: Re:  Re: . in for)
Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> wrote:
> Function names are indistinguishable from element names,
[...]
Well, i realized it somewhat too late as you have seen in my
follow-up...

> You could do:
>   map('xf:lower-case', $departments)
> but of course this will only work with functions (rather than any
> expression), and only with functions whose sole argument was an item.

I was thinking about the equivalent of C function pointers. It may
be inconvenient to wrap simple expressions in functions for the sole
purpose of applying them to a map, but it seems to work for a
reasonable large audience (see below for caveat). However:

> ... rather than any expression ...

This means you want lambda expressions.

>  - define a map expression (rather than a map() function)

Note that in you proposal of a mapping operator
  $coordinates -> (. * 2)
the second operand actually *is* already a lambda expression. Hint:
the . is not bound to the value of the context node as it would
have been in ordinary expressions.
We can argue about inventing an XPath function xf:lambda() for this
purpose, with all the consequences. I'd probably like it to have one,
but i let it to Dmitre to make up the full proposal... :-)

Well, the C++ STL got around not having lambdas using the template
expressions technique. Is there anyone who could to an analysis whether
- C++ template expressions are equivalent to lambdas and
- there is a way to do something similar in XSLT?

> But as Dimitre's explained, if we just had functions as objects in the
> data model we wouldn't be banging our heads against this - we could
> have a map function no problems at all.

I some sense, we already have, just somewhat restricted, in form of
"for" and similar operators. With full lambdas, we could get rid of them.
IMHO this is a laudable goal.

Regards
J.Pietschmann

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.