} catch (XPathException e) {
e.setLocator(this);
throw e;
}
ValueRepresentation val = b.getGlobalVariableValue(this);
if (wasSupplied || val!=null) {
return val;
} else {
if (isRequiredParam()) {
XPathException e = new XPathException("No value supplied for required parameter $" +
getVariableQName().getDisplayName());
e.setXPathContext(context);
e.setLocator(getSourceLocator());
e.setErrorCode(isXSLT() ? "XTDE0050" : "XPDY0002");
throw e;
} else if (isImplicitlyRequiredParam()) {
XPathException e = new XPathException("A value must be supplied for parameter $" +
getVariableQName().getDisplayName() +
" because there is no default value for the required type");
e.setXPathContext(context);
e.setLocator(getSourceLocator());
e.setErrorCode("XTDE0610");
throw e;
}
// This is the first reference to a global variable; try to evaluate it now.
// But first set a flag to stop looping. This flag is set in the Bindery because
// the VariableReference itself can be used by multiple threads simultaneously
try {
b.setExecuting(this, true);
ValueRepresentation value = getSelectValue(context);
b.defineGlobalVariable(this, value);
b.setExecuting(this, false);
return value;
} catch (XPathException err) {