PsiReference[] (final XmlAttribute attribute) { final PsiReference[] psiReferences; final XmlTag tag = attribute.getParent(); if (XsltSupport.isTemplateCallName(attribute)) { psiReferences = createReferencesWithPrefix(attribute, new TemplateReference(attribute)); } else if (XsltSupport.isTemplateCallParamName(attribute)) { final String paramName = attribute.getValue(); final XmlTag templateCall = PsiTreeUtil.getParentOfType(tag, XmlTag.class); if (templateCall != null) { if (XsltSupport.isTemplateCall(templateCall)) { final XsltCallTemplate call = myXsltElementFactory.wrapElement(templateCall, XsltCallTemplate.class); final ResolveUtil.Matcher matcher = new MyParamMatcher(paramName, call); psiReferences = new PsiReference[]{ new AttributeReference(attribute, matcher, true) }; } else if (XsltSupport.isApplyTemplates(templateCall)) { final XsltApplyTemplates call = myXsltElementFactory.wrapElement(templateCall, XsltApplyTemplates.class); final ResolveUtil.Matcher matcher = new MyParamMatcher2(paramName, call); psiReferences = new PsiReference[]{ new ParamReference(attribute, matcher) }; } else { psiReferences = PsiReference.EMPTY_ARRAY; } } else { psiReferences = PsiReference.EMPTY_ARRAY; } } else if (XsltSupport.isParam(attribute) && isInsideUnnamedTemplate(tag)) { final XsltParameter myParam = myXsltElementFactory.wrapElement(tag, XsltParameter.class); psiReferences = new PsiReference[]{new MySelfReference(attribute, myParam)}; } else if (XsltSupport.isVariableOrParamName(attribute) || XsltSupport.isTemplateName(attribute)) { final XsltElement myElement = myXsltElementFactory.wrapElement(tag, XsltElement.class); psiReferences = createReferencesWithPrefix(attribute, SelfReference.create(attribute, myElement)); } else if (XsltSupport.isFunctionName(attribute)) { final XsltFunction myElement = myXsltElementFactory.wrapElement(tag, XsltFunction.class); psiReferences = createReferencesWithPrefix(attribute, SelfReference.create(attribute, myElement)); } else if (XsltSupport.isIncludeOrImportHref(attribute)) { final String href = attribute.getValue(); final String resourceLocation = ExternalResourceManager.getInstance().getResourceLocation(href, attribute.getProject()); if (href.equals(resourceLocation)) { // not a configured external resource if (!URLUtil.containsScheme(href)) { // a local file reference final FileReferenceSet filereferenceset = new FileReferenceSet( href, attribute.getValueElement(), 1, XsltReferenceProvider.this, true); psiReferences = filereferenceset.getAllReferences(); } else { // external, but unknown resource psiReferences = new PsiReference[]{ new ExternalResourceReference(attribute) }; } } else { // external, known resource psiReferences = new PsiReference[]{ new ExternalResourceReference(attribute) }; } } else if (XsltSupport.isMode(attribute)) { psiReferences = ModeReference.create(attribute, XsltSupport.isTemplate(tag, false)); } else if ((attribute.getLocalName().equals("extension-element-prefixes") || attribute.getLocalName().equals("exclude-result-prefixes")) && XsltSupport.isXsltRootTag(tag)) { psiReferences = createPrefixReferences(attribute, PREFIX_PATTERN); } else if (attribute.getLocalName().equals("stylesheet-prefix") && tag.getLocalName().equals("namespace-alias")) { psiReferences = createPrefixReferences(attribute, PREFIX_PATTERN); } else if ("elements".equals(attribute.getLocalName())) { if (("strip-space".equals(tag.getLocalName()) || "preserve-space".equals(tag.getLocalName()))) { psiReferences = createPrefixReferences(attribute, ELEMENT_PATTERN); } else { psiReferences = PsiReference.EMPTY_ARRAY; } } else { psiReferences = PsiReference.EMPTY_ARRAY; } return psiReferences; }