Thanks for the quick response.
Yes, I know XPath3 is not stabilized, but I (we) do not want to use XPath3 at all yet. We just want to migrate to 9.4.0.x to be compatible with eXist who want to move to this version as well.
I just checked the 9-3 source and there the nextToken method is identical… So it is in the creation of the xpath statements where something is changed. An attempt to create a standalone testcase (independent of BetterFORM) still did not succeed.
Just looked at the NamePool where the ClarkName is created and there definitely has been a big change there, so it might be related to something there.
If I need to provide some additional information (run it with breakpoints at certain places e.g.) let me know.