public boolean evaluateUseWhen(Expression expr, UseWhenStaticContext staticContext) throws XPathException {
ItemType contextItemType = Type.ITEM_TYPE;
ExpressionVisitor visitor = ExpressionVisitor.make(staticContext, staticContext.getExecutable());
expr = visitor.typeCheck(expr, contextItemType);
SlotManager stackFrameMap = new SlotManager();
ExpressionTool.allocateSlots(expr, stackFrameMap.getNumberOfVariables(), stackFrameMap);
Controller controller = new Controller(getConfiguration());
// TODO:CLAXON ensure calls on doc() are unsuccessful
controller.setCurrentDateTime(currentDateTime);
// this is to ensure that all use-when expressions in a module use the same date and time
XPathContext dynamicContext = controller.newXPathContext();