Small bug fixes, features, and refactoring

Hi, Max.  This pull request has the following:

*   Bug fix: a thinko in the code to parse `:not(…)` prevented use of attribute selectors immediately after it
*   Feature: `:nth-child(odd)` and `:nth-child(even)`
*   Portability: translation of `[attr$=tail]` no longer needs XPath 2.0

In addition, there are some small refactorings; if you don’t want those, let me know, and I’ll edit the PR to exclude them.

Thanks.