void (@NotNull MultiHostRegistrar registrar, @NotNull PsiElement context) { XmlAttributeValueImpl value = (XmlAttributeValueImpl)context; PsiElement parent = value.getParent(); if (!(parent instanceof XmlAttribute attribute)) return; if (!XsltSupport.isXPathAttribute(attribute)) return; ASTNode type = value.findChildByType(XmlElementType.XML_ENTITY_REF); if (type != null) return; // workaround for inability to inject into text with entity refs (e.g. IDEA-72972) TODO: fix it final XsltChecker.LanguageLevel languageLevel = XsltSupport.getXsltLanguageLevel(attribute.getContainingFile()); final TextRange[] ranges = getInjectionRanges(attribute, languageLevel); for (TextRange range : ranges) { // workaround for http://www.jetbrains.net/jira/browse/IDEA-10096 TextRange rangeInsideHost; String prefix; if (range instanceof AVTRange) { if (((AVTRange)range).myComplete) { rangeInsideHost = range.shiftRight(2).grown(-2); prefix = ""; } else { // we need to keep the "'}' expected" parse error rangeInsideHost = range.shiftRight(2).grown(-1); prefix = "{"; } } else { rangeInsideHost = range; prefix = ""; } if (value.getTextRange().contains(rangeInsideHost.shiftRight(value.getTextRange().getStartOffset()))) { registrar.startInjecting(languageLevel.getXPathVersion().getLanguage()) .addPlace(prefix, "", value, rangeInsideHost) .doneInjecting(); } } }