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

> If we remove the "full" for from XPath, then I agree that let 
> would be 
> needed. I don't want to give up the ability to access 
> intermediate context 
> nodes (as opposed to being restricted to the ends of the 
> spectrum, i.e. . 
> and current()).

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)]]

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.

Michael Kay

Received on Wednesday, 22 May 2002 14:18:09 UTC