From: Phlip Date: 2007-07-15T14:30:04+09:00 Subject: Re: Double slash in Hpricot...? Daniel Waite wrote: > What's the purpose of the double slash in Hpricot? > > doc.search("/html/body//p") Google for an XPath tutorial. // is XPathic for the "any descendant" axis. So the above matches any

(presumably the first) in the body of a document. The equivalent in XPath would be assert_xpath('/html/body//p'). I don't know how close Hpricot comes to XPath, which can do things like this: assert_xpath ".//Statement[ last() - 1 ]" That matches the second-to-last item called However, REXML::XPath cannot handle common XHTML idioms... Can't we all just ... get along? -- Phlip http://www.oreilly.com/catalog/9780596510657/ "Test Driven Ajax (on Rails)" assert_xpath, assert_javascript, & assert_ajax