public ValueRepresentation evaluateVariable(XPathContext context) throws XPathException {
final Controller controller = context.getController();
final Bindery b = controller.getBindery();
final ValueRepresentation v = b.getGlobalVariable(getSlotNumber());
if (v != null) {
return v;
} else {
// 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) {