[Xpath-ng] Positional predicates (WAS: Minimal FIXPath (with a bonus)?)
Joe English
jenglish at flightlab.com
Tue Jan 7 09:25:34 MST 2003
Jeni Tennison wrote:
> [...] I'd also suggest limiting
> predicates to positional predicates in the core version, or perhaps
> omitting them altogether (XML Schema doesn't use them).
I'm strongly in favor of omitting positional predicates,
and using a different syntax for selection by position
(perhaps an infix operator "list # n", or a function
"nth(list, n)").
This would be a significant simplification. The dynamic
parts of the evaluation context -- the context size and
context position -- would no longer be needed, leaving
only the static parts. It would remove one of the major
obstacles to optimization (you can't optimize "expr[$n]" without
knowing if $n is a number or something else). In the absense
of "last()", fully lazy evaluation becomes possible. It would
make predicates associative -- (expr[p1])[p2] = (expr[p1][p2]) --
which is not the case in XPath 1.0. Some of the most
obscure and confusing parts of the XPath spec could be
removed.
The "foo[n]" syntax in XPath is a DWIM gone bad.
I think we should drop it, if we can get away with it.
--Joe English
jenglish at flightlab.com
More information about the Xpath-ng
mailing list