# File lib/hpricot/traverse.rb, line 154 def xpath if elem? and has_attribute? 'id' "//#{self.name}[@id='#{get_attribute('id')}']" else sim, id = 0, 0, 0 parent.children.each do |e| id = sim if e == self sim += 1 if e.pathname == self.pathname end p = File.join(parent.xpath, self.pathname) p += "[#{id}]" if sim >= 2 p end end