_funcResolver = funcResolver;
}
public Expression bind(int nameCode, String uri, String local, Expression[] staticArgs) throws XPathException {
QName name = new QName(uri, local);
XPathFunction function = _funcResolver.resolveFunction(name, staticArgs.length);
if (function == null) {
return null;
}
// Converting the expression array to the simple string
ArrayList args = new ArrayList(staticArgs.length);
for (Expression expression : staticArgs) {
String exprStr = expression.toString();
if (exprStr.startsWith("\"")) exprStr = exprStr.substring(1);
if (exprStr.endsWith("\"")) exprStr = exprStr.substring(0, exprStr.length() - 1);
args.add(exprStr);
}
try {
function.evaluate(args);
} catch (XPathFunctionException e) {
throw new StaticError(e);
}
XPathFunctionCall fc = new XPathFunctionCall(function);
fc.setArguments(staticArgs);