Hpricot

Since you are using XPath, you can try with something like

links = page.search('/html/body//a[@href=http://www.joe.net]')

Explanation: The brakets let you specify a filter for your search and you can use @ to access an attribute inside an element.

Also, for more complicated stuff you can just traverse the array that the method search returns like so:

links.each do |link|   if LINK MEETS CRITERIA do stuff end