I just realized this patch causes regressions with my earlier patch for the 'preceding' axis. I'm currently looking for a comprehensive XPath test suite, and I'll try to instead submit one large patch (or at least a handful at once) once I've been able to do that.