tags:

views:

17

answers:

2

Hi,

I need to select a node with a id attribute that i only know part of the value.

if i have several:

<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 doesnt work

any help??? thanks

+3  A: 
//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.

Wrikken
thanks alot ~:D
Narven
A: 

Have you tried

//tr[@id*="foobar"]

I'm not certain this works, but it may.

meder