Re: [xml] preceding-sibling::*

On Thu, Aug 04, 2005 at 08:33:28AM -0400, Karanjit Siyan wrote:
I have found that LibXML is incorrectly returning the nodeset in the 
XPath expression:


in document order instead of *reverse* document order.

So instead of


for a given context returning the most immediate preceding sibling, it 
returns the preceding sibling furthest away from the current context.

Is this a known bug? Is there a fix for this?

Did you tried just
or both ? 
What API di you used for this ?
On what document ?
There is no known XPath bug in libxml2 or libxslt as far as I remember.

By default the compiler for an XPath expression sorts back to document order
  paphio:~/XML -> ./testXPath --tree 'preceding-sibling::*'
Compiled Expression : 3 elements
    COLLECT  'preceding-sibling' 'all' 'node'

but preceding-sibling::*[1] should be the right one.
So your report is incomplete, possibly bogus, but I can't tell you gave
little useful informations.

Also read
   "6 Conformance

    XPath is intended primarily as a component that can be used by other
    specifications. Therefore, XPath relies on specifications that use XPath
    (such as [XPointer] and [XSLT]) to specify criteria for conformance of
    implementations of XPath and does not define any conformance criteria
    for independent implementations of XPath."

I.e. if you had an XSLT stylesheet it would be way easier to give
a definite answer back whether it's a bug or not.

Were you evaluating this as an Expr production [14] or a LocationPath [1] ?

I tested the expression under XMLSpy 2005 and it returns the correct 

  Depends what API and the semantic of their API. Also assumes XMLSpy
has no bugs, which ahum is a risky assumption !


Daniel Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]