Re: Transitive closure for XPath

> Yes. Saxon's solution is to combine this with the facility to create an
> expression from a string, so you write
> 
> saxon:sum($nodeset, saxon:expression("@price * @qty"))

Sounds good. Now, is anyone going to submit a proposal for allowing
higher order functions in XPath 2.0, along with a TC function?

closure($nodeset, expression("id(./@id)") would be very neat indeed. 

(Although this still has problems: the function passed as the second
argument must contain a relative expression. Imagine a transitive
closure where to find the next element you must traverse the whole tree
to find a matching element, for example if the nodes do not have IDs.
How do you refer to the current node to compare each element in the tree
with ? My implementation currently gets around this by introducing a
fake $basenode variable in the context of a closure:
closure($node,//x[@attrib=$basenode/@attribref]))

Also, is it possible to get information on progress in this area from
the WG ?

Christian Nentwich

Received on Thursday, 26 April 2001 05:29:39 UTC