Hpricot and XPaths with indices

Hello,

I just started to use HPricot a few days ago (what a cool piece of
software! :wink: so it is possible that I have just overlooked it but I did
not find a way to evaluate XPaths with indices yet. Instead of a general
XPath, e.g.:

(doc/‘//div/table/tr/td/img’)

I would like to lookup an indexed one:

(doc/‘//div[2]/table[3]/tr[2]/td[8]/img[2]’).

OK, I guess this is doable by ((doc/'//div)[2]./table)[3]… or
something similar, but is this the only (and accepted) way?

TIA,
Peter
http://www.rubyrailways.com

http://code.whytheluckystiff.net/hpricot/wiki/SupportedXpathExpressions

Yay rftdocs. Hpricot’s XPath syntax seems quite incomplete, either e.g.
div:eq(0) will work or nothing will.

David V.

On Sat, Oct 07, 2006 at 09:53:51AM +0900, David V. wrote:

http://code.whytheluckystiff.net/hpricot/wiki/SupportedXpathExpressions

Yay rftdocs. Hpricot’s XPath syntax seems quite incomplete, either e.g.
div:eq(0) will work or nothing will.

Very true. And there are plans to enhance:
http://code.whytheluckystiff.net/hpricot/roadmap

Unfortunately, I am six days late as of this day. That is frownworthy,
I know.

_why