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:
>
> preceding-sibling::*
>
> in document order instead of *reverse* document order.
>
> So instead of
>
> preceding-sibling::*[1]
>
> 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
preceding-sibling::*
or
preceding-sibling::*[1]
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
SORT
COLLECT 'preceding-sibling' 'all' 'node'
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
http://www.w3.org/TR/xpath#section-Conformance
"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
> order.
Depends what API and the semantic of their API. Also assumes XMLSpy
has no bugs, which ahum is a risky assumption !
Daniel
--
Daniel Veillard | Red Hat Desktop team http://redhat.com/
[EMAIL PROTECTED] | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml