Fix :nth-*(an+b) pseudo-classes selectors for negative a's

I rewrote `xpath_nth_child_function()` to follow the logic I wrote down on paper with simple equations. It's not the nicest code.

I also changed the expected result for `li:nth-last-child(2n+2)`:
as I understand the W3C specs, *an+b-1 siblings after* should return `li`'s that have 2n+1 siblings after them, so `li` 6, 4 and 2 (of the 7 `li` in the test document)
http://www.w3.org/TR/selectors/#nth-last-child-pseudo
This is a huge diff unrelated to the rest of the commit. Could you avoid touching non-trailing whitespace? Or if you really want to get rid of tabs, please do it in a separate commit.