- From: David Carlisle <davidc@nag.co.uk>
- Date: Wed, 22 May 2002 09:50:15 +0100
- To: Michael.Kay@softwareag.com
- CC: public-qt-comments@w3.org
me> The fact that for expressions mean that it possible in XPath to bind
me> variables to items but not to sequences is a very strange state of
me> affairs.
mike> You think we should allow "let" in XPath?
On reflection, I think yes.
mike>* provide a simple (context-based) FOR expression only
mike>* provide a full FOR expression with range variables
mike>* provide both
A suggestion.
* Remove the "full" for from Xpath.
* Provide a simpler context based for, either something like
"foreach" Expr "return" Expr
or something more symbolic, Xpath-like syntax, I'd quite like
Expr => Expr
(with => taking the same precedence as /, and doing a similar job but
not restricted to node sequences and not applying doc-order to the
result) I know => is currently being used for something else....
* Provide let (with the current XQuery syntax)
The advantages of this over the current situation are
a) that simple mappings over sequences (by far the majority case in
Xpath use, I would expect) are simpler, not requiring explicit variables
at all.
b) There is more functionality for more complicated cases as you can
bind any value to a variable, not just non-sequence items. For nested
for constructs where you need variables to save the context you'd do the
equivalent of what you do already for xsl:for-each, something like
foreach $lista return
let $a . in
foreach $listb
return my:f(.,$a)
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.
Received on Wednesday, 22 May 2002 04:50:41 UTC