xml - Conditional XPath matching -
i have xml looks this...
<tbody> <tr> <td> <h5> <a class="foo" name="bar">this element want condition on.</a> </h5> </td> </tr> <tr> <td> <a href="/generic/generic">this element want match on</a> <td> <td></td> <td></td> </tr> <tbody>
how match on second first 's name attribute "bar", using xpath?
this expression work...
//tr[preceding-sibling::tr/td/h5/a/@name = 'bar']/td/a
but there errors in xml. here's edited version:
<tbody> <tr> <td> <h5> <a class="foo" name="bar">this element want condition on.</a> </h5> </td> </tr> <tr> <td> <a href="/generic/generic">this element want match on</a> </td> <td></td> <td></td> <td></td> </tr> </tbody>
Comments
Post a Comment