class Nokogiri::CSS::Parser

def xpath_for string, options={}

Get the xpath for +string+ using +options+
def xpath_for string, options={}
  key = "#{string}#{options[:ns]}#{options[:prefix]}"
  v = self.class[key]
  return v if v
  args = [
    options[:prefix] || '//',
    options[:visitor] || XPathVisitor.new
  ]
  self.class[key] = parse(string).map { |ast|
    ast.to_xpath(*args)
  }
end