Clear cached XPathContext after attribute change or node removal

In following up on #1034 and trying to fix a bunch of failing tests in [projecthydra/om](http://github.com/projecthydra/om) under JRuby, I discovered some XPath queries returning incorrect nodesets. It turned out that while the cached XPathContext was being cleared after certain node manipulations, it wasn't being properly cleared after attribute modifications or node removal.

Both of the added tests fail on the current master and pass with these changes.