[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Transitive closure for XPath
- From: Christian Nentwich <c.nentwich@cs.ucl.ac.uk>
- To: Joe English <jenglish@flightlab.com>, xml-dev@lists.xml.org
- Date: Thu, 19 Apr 2001 22:05:44 +0100
> The proposal as described slightly breaks the XPath evaluation
> model though: the second argument to 'closure(node-set,node-set)'
> has Algol-style call-by-name semantics. That is, it's not really
> a node-set but rather an XPath expression or "thunk" which
> is re-evaluated with a different context multiple times.
> I think this calls for new syntax, either a new keyword or operator.
Damn someone noticed :) But, to be serious, yes it breaks the XPath grammar.
I just wrote it up quickly, but..
> closure(/ROOT/node[1], id(./@child))
>
> in your example would be written:
>
> /ROOT/node[1]/(id(./@child))*
as you pointed out, evaluating the first in an existing xpath engine is a
lot easier, since you just need to plug in another function.
From a logical point of view, perhaps a new axis (e.g.
/root/node[1]/closure::id(./@child)) would make sense, but a new function is
a lot easier to implement..
Christian