Thanks for your sterling efforts to get to the bottom of this.

First, you're right that 9.4 is still supporting the "uri":local syntax rather than the newer Q{uri}local.

I suspected that the function call instance('xxx') might be causing problems because of the conflict with the "instance of" operator. So I did a modified build in which the instance() function was defined, and it ran without trouble.

I can't see any way the tokenizer can return a name in the format {}amount unless there is a string literal in the source immediately followed by a colon.

I'd be interested to know how you enable Saxon to recognize the instance() and current() functions which are not normally supported in XPath.

We should probably change the code so that the tokenizer doesn't recognize "uri":local unless the parser is going to accept it, but that doesn't seem to be at the root of the problem. In your debugging, did you see what path the tokenizer was taking before it returned {}amount?

I'm confused by this statement: "When the expression is build, nothing fails but when it is actually evaluated, it fails with the exception above.", since the error message is clearly one that can only arise during XPath parsing. I wonder if it's the case that the instance() function invokes some dynamic XPath parsing?

Michael Kay

On 08/08/2012 10:21, Ronald van Kuijk wrote:
string(../amount * instance('convTable')/rate[@currency=current()/../currency])