This isn't a matter of thread-safety but of data integrety; if the cache is out of synch with the document, you will get incorrect results at best. If you are changing the source document, you can *NOT* currently use CachedXPathAPI safely -- or, more accurately, you must discard and reload the cache (by switching to a new instance of CachedXPathAPI) between queries, and changing the source document during a query is *never* safe.
I have a draft of a highly experimental "thin layer" adapter (DOM2DTM2) which is intended to minimize the amount of cached data and thus be able to tolerate alterations between XPath invocations without reloading the whole thing. It's checked in on the XSLT20 branch, though disabled (there's a manefest constant in DTMManagerDefault which can be set true to enable it). Currently performance is definitely not good. On the other hand, it is non-linearly incremental, and depending on your use case that may recover enough performance to make it interesting. I believe it can be improved, when we have some time to do further work on it. ______________________________________ Joe Kesselman / IBM Research
