Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selecting a specific table with XPath

I've got an XHTML document, and I want to select the only table in it with class="index".

If I understand correctly, the descendant axis will select all nodes directly and indirectly descending from the current node, so here's what I've got.

//descendant::table[@class="index"]

It doesn't appear to be working when tested with xmlstarlet. Is my tool broke, or is the XPath expression wrong?

like image 553
jldugger Avatar asked Apr 16 '26 13:04

jldugger


1 Answers

I think //table[@class="index"] is what you want

like image 164
Brian Agnew Avatar answered Apr 19 '26 06:04

Brian Agnew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!