Getting absolute path from xpath selectors

Is it possible for the xpath selection to return the absolute path for every node found?

for a quick example

//chapter

      

to return

//book[1]/chapter
//book[2]/chapter
...

      

thanks

0


a source to share


2 answers


There is no easy way to do this just using XPath. If you are using XSLT there are several recipes available, for example http://www.dpawson.co.uk/xsl/sect2/N6077.html#d7984e96 .



+2


a source


The pythons lxml module can do this by calling the getpath method .



0


a source







All Articles