XPath support

(This depends on pull request #13, so parts of it are included -- ignore them, the diff should start with 96bb22b)