Dear Gunther,
Thank you for the test code. I gradually changed it into my code
that did not work, and found the problem:
private static Expr[]
parameterVars(FuncType funcType, QueryContext queryContext)
{
Expr[] paramVars = new
Expr[funcType.argTypes.length];
for (int i = 0; i <
paramVars.length; ++i) {
paramVars[i] = new VarRef(null,
new VarScope().addNew(new QNm("arg"+i), funcType.argTypes[i],
queryContext, null));
}
return paramVars;
}
I was trying to be clever, and derive the parameter
VarRefs from the function type. But this
cannot get to the original parameter names, and I invented new
names;
new QNm("arg"+i). But these
names are different from the original names, and somehow this
means that in some cases there will be no parameters on the stack.
What is strange / interesting, is that with the above code, the
following works:
let $ner-parse :=
ner:named-entity-recognition($grammar, map{})
return $input => $ner-parse()
But using a declared variable does not work:
declare variable $ner-parse as
function(item()) as node()* :=
ner:named-entity-recognition($grammar,map{});
$input => $ner-parse()
Now I make sure I use the same names for the generated
VarRefs, and my function is always
called with the parameter values on the stack.
Thanks for your help!
Best regards,
Nico