Is it possible get all context nodes used to evalute xpath result ? In below code:
test_xml = """
<r>
<a/>
<a>
<b/>
</a>
<a>
<b/>
</a>
</r>
"""
test_root = lxml.etree.fromstring(test_xml)
res = test_root.xpath("//following-sibling::*[1]/b")
for node in res:
print test_root.getroottree().getpath(node)
Result are: /r/a[2]/b /r/a[3]/b
Is it possible to get all context nodes used in above xpath evaluation:
/r/a[1] /r/a[2] /r/a[2]/b
and for second result:
/r/a[2] /r/a[3]/b /r/a[3]/b
? When using child axis I could get those nodes from working on element_tree.getpath(elem) but what abouth other axes ? TIA, regards