def visit_pseudo_class node
if node.value.first.is_a?(Nokogiri::CSS::Node) and node.value.first.type == :FUNCTION
node.value.first.accept(self)
else
msg = "visit_pseudo_class_#{node.value.first.gsub(/[(]/, '')}""visit_pseudo_class_#{node.value.first.gsub(/[(]/, '')}"
return self.send(msg, node) if self.respond_to?(msg)
case node.value.first
when "first" then "position() = 1"
when "last" then "position() = last()"
when "first-of-type" then "position() = 1"
when "last-of-type" then "position() = last()"
when "only-of-type" then "last() = 1"
when "empty" then "not(node())"
when "parent" then "node()"
when "root" then "not(parent::*)"
else
node.value.first + "(.)"
end
end
end