backtrack-xpath accepts a REXML::Element and returns the full XPath back to the root.
gem "backtrack-xpath", "~> 0.1.0"