UsageGroup (PsiElement referencedElement, UsageInfo u, boolean mustBeForeign) { if (referencedElement instanceof XsltParameter parameter) { final PsiElement element = u.getElement(); if (element == null) return null; final XsltTemplate template = XsltCodeInsightUtil.getTemplate(element, false); if (template == null) return null; final boolean isForeign = XsltCodeInsightUtil.getTemplate(parameter, false) != template; if (template.getMatchExpression() != null && (isForeign || !mustBeForeign)) { return new TemplateUsageGroup(template); } } return null; }