W3C home > Mailing lists > Public > public-qt-comments@w3.org > May 2002

Re: variable binding in XPath was: Comments on XPath (30th April)

From: Jeni Tennison <jeni@jenitennison.com>
Date: Thu, 23 May 2002 05:48:08 -0400 (EDT)
Message-ID: <169326937691.20020523104802@jenitennison.com>
To: public-qt-comments-request@w3.org, "Kay, Michael" <Michael.Kay@softwareag.com>
CC: Evan Lenz <evan@evanlenz.net>, David Carlisle <davidc@nag.co.uk>
Mike wrote:
> Yes. The strongest use case for adding LET is that it would allow
> you to bind to the context node at each level of predicate nesting:
>
>    chapter[let $c := @id return section [starts-with(@id,$c)]]

Yes, that's very very useful. I agree with David -- adding let would
allow you to get rid of specialised range variables and provide useful
functionality on the XPath side without forcing people to write
user-defined functions to achieve their goals. It's essential if you
don't allow sequence generation with XSLT, and I think it makes a good
balance in either case.

> I don't like the syntax: it would be much nicer to write
>
>    chapter[$c; section [starts-with(@id,$c/@id)]]
>
> but at least it gives the functionality.

I like the shorter syntax (assuming that it would support assignment
to any expression, not just the context node (though the shorthand for
the context node would be lovely)). Like David, I would favour an
symbolic infix operator for the foreach expression too (e.g. '=>' or
'->') because of the parallel with the '/' operator. But with the
amount of code we're looking at being tucked up in an XPath, keywords
definitely make things a lot clearer.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Thursday, 23 May 2002 11:50:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:14:22 GMT