I need to select a node with a id attribute that I only know part of the value.
If I have several <tr>
elements:
<tr id="foobar[1234]"></td><tr id="foobar[1235]"></td><tr id="foobar[1236]"></td><tr id="bar[1]"></td><tr id="foobar[1237]"></td><tr id="bar[12]"></td>
I only want to select the id's that start with foobar
.
I've tried:
//tr[@id='foobar*']
but it doesn’t work.
Any help? Thanks.
//tr[starts-with(@id,'foobar')]
A list of XPath 1.0 functions: http://www.edankert.com/xpathfunctions.html
If your implementations supports XPath 2.0, you get a lot of other ones.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With