XPathVariable (XPathVariableReference reference) { final XmlTag context = getContextTagImpl(reference); final VariableResolveProcessor processor = new VariableResolveProcessor(reference.getReferencedName(), context); final XPathVariable variable = (XPathVariable)ResolveUtil.treeWalkUp(processor, context); if (variable != null) { return variable; } if (!processForwardGlobals(context, processor)) { final XmlFile file = PsiTreeUtil.getParentOfType(context, XmlFile.class, true); if (file != null) { XsltIncludeIndex.processBackwardDependencies(file, xmlFile -> { processor.processExternalFile(xmlFile, context); return processor.shouldContinue(); }); } } return (XPathVariable)processor.getResult(); }