This test has uncovered a number of bugs in our XPath implementation - some are already fixed, some aren't yet. I think it would be useful to land it in its entirety.
I wrote the author and got a permission to include the test in WebKit repository.
Created attachment 17296 [details]
The failing cases are caused by DOM-level problems AFAICT (lang and processing instruction nodes).
Comment on attachment 17296 [details]
Committed revision 27836.