Polat Tuzla, 09.11.2009 14:01:
I'm observing that xpath axis "ancestor-or-self" does not function properly. Below outputs demonstrate the case. In the first one whole tree is printed, and in the second one ancestor-or-self is used, but the result does not differ.
I'll open a ticket for this as a bug, unless someone tells me that I'm missing a point. Thanks,
Polat Tuzla
In [309]: print etree.tostring(root, pretty_print=True) <a> <b> <c/> <x> <z/> </x> </b> </a>
In [310]: print etree.tostring(root.xpath("/a/b/c/ancestor-or-self::*")[0], pretty_print=True) .....: <a> <b> <c/> <x> <z/> </x> </b> </a>
Note that you only look at the first result using the "[0]" subscript, which in this case is the root node. Stefan