Bobulous wrote:Customised regular expressions can very likely isolate any element regardless of the enclosing structure.
But like I said, why not use the tools developed for the purpose?
Bobulous wrote:But sometimes a simple, generic function will do the job just fine.
Exactly. So why not use one instead of mucking around with regular expressions?
--
Find all tables that contain cells with a colspan greater than one contained in rows of class "wide". Note that tables may be nested. And the entire matching table is wanted.
//table[tr[@class='wide']/td[@colspan>1]]
--
Oh, you just want an img element? Well, I don't know if the element appears more than once or not, and I don't know if you want all of them or just the one (or which). So I'll play it safe and and retrieve all of them.
//img
Ah, you just want the first.
code[1][/code]
...Sorry, the last.
code[last()][/code]
Er, the last to not have an alt attribute
(//img[not(@alt)])[last()]