[Xpath-ng] FIXPath (XPath NG core) straw man draft posted

Uche Ogbuji uche.ogbuji at fourthought.com
Sun Jan 5 17:29:16 MST 2003


> Uche Ogbuji wrote:
> 
> >I've been working on this here and there as time has allowed, but I thought it 
> >was better to just get out something respectable and make the refinements 
> >among the group, so I finished up a first draft of the XPath NG core this 
> >weekend.
> >
> Section "Overview"/*
> 
> Issue: */ The merge operation is defined with location paths in mind. 
> But what about reverse axes? Des this mean that a merge cannot always 
> resolve to document order?
> 
> As you can walk nodes of a document in document order (whatever that 
> means...), give the first node the number 1 and the next node the 
> previous number + 1, it follows that every node in a document has a 
> unique number (the node id) and that sorting nodes by that number gives 
> you the nodes in document order.
> 
> Merging two lists, sorting them by the node id will produce the asked 
> for result, so it's not an issue IMO.

Thanks for the comment.  I didn;t have a chance to think things out in 
exhaustive detail, so I just put up the issue just in case.  You may be right. 
 Since reverse axes usually make my head explode, I'll outline my thinking for 
comment:

My thinking was that if a merge operation occured in a situation such as

ancestor:*/child::*

i.e. the LHS returns the nodes in *reverse* document order, does this cause 
any problem that the result of the overall expression forces everything back 
to forward document order because of the merge?  I think this may indeed be a 
problem.  If my doc is:

<a><b><c/></b><d/><e/></a>

and the context node is c, then I think I would expect 

ancestor:*/child::*

to result in

[c, b, d, e, a]

But the way I have merge in the straw man, instead we'd get

[a, b, c, d, e]

Or is my brain indeed fried?  :-)

Side note: I guess we really need a sort-doc-order() function for lists.


-- 
Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
A Python & XML Companion - http://www.xml.com/pub/a/2002/12/11/py-xml.html
XML class warfare - http://www.adtmag.com/article.asp?id=6965
MusicBrainz  metadata - http://www-106.ibm.com/developerworks/xml/library/x-thi
nk14.html





More information about the Xpath-ng mailing list