It works! I have tried it on Java 5 with both built-in (com.sun.org.apache.xpath.internal) and Xalan 2.6.0 imports.
I guess the code didn't work the first time because the XPath classes bundled with Java 1.4.2 were called. I may check it against older versions of Xalan to be sure. The final solution looks OK, I just wish it had been better documented. I guess these methods were not meant to be publicly used, but this really is an integral part of XPath specification: the context for evaluating expressions in not only one node. I believe Apache implementation covers full functionality of XPath, and it should be easy for programmers to use it. Once again, thank you for your help!
