From: Wang Jian Date: 2009-04-06T20:11:20+09:00 Subject: A few confusing Hpricot outputs. Anyone had similar experience? --000e0cd28c06f9e84a0466e0f755 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit ## I wanted to work on something like the following example string require 'hpricot' string = 'posted on April 2009' h = Hpricot(string) t = "2009-04-06" ## Here it goes: confusion No.1 h.at('a[@title*="2009-04-06"]') ##=> returns the 2nd anchor element, as expected. h.at('a[@title*=Time.now.strftime("%Y-%m-%d")]') ##=> *1st anchor element. Why is that??* h.at("a[@title*=#{t}]") ##=> 2nd anchor. works fine h.at('a[@title*="#{t}"]') ##=> *nil. Because of the single quote?* ## And here comes another confusion: year = "2009" h.at("a[@title*=#{t}][text()*='2009']") ##=> 2nd anchor, as expected. h.at("a[@title*=#{t}][text()*=#{year}]") ##=> *nil. Why is that? Hpricot can't handle #{} more than once?* ## Hope you can fill me in on this one. Thanks!! ##Jay --000e0cd28c06f9e84a0466e0f755--