List<XPathVariableReference> (PsiElement block) { final VariableReferenceCollector visitor = new VariableReferenceCollector(); block.accept(visitor); final List<XPathVariableReference> list = new ArrayList<>(visitor.getMatches()); list.sort(XsltCodeInsightUtil.POSITION_COMPARATOR); return list; }