0, Token.EOF, getDocumentLocator().getLineNumber(locationId), false);
expr.setContainer(staticContext);
ItemType contextItemType = Type.ITEM_TYPE;
ExpressionVisitor visitor = ExpressionVisitor.make(staticContext);
expr = visitor.typeCheck(expr, contextItemType);
SlotManager stackFrameMap = getPipelineConfiguration().getConfiguration().makeSlotManager();
ExpressionTool.allocateSlots(expr, stackFrameMap.getNumberOfVariables(), stackFrameMap);
Controller controller = new Controller(getConfiguration());
controller.setURIResolver(new URIPreventer());
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();