XmlAttributeValuePattern (ElementPattern<String> namePattern) { return with(new PsiNamePatternCondition<>("withLocalName", namePattern) { @Override public String getPropertyValue(@NotNull final Object o) { if (o instanceof XmlAttributeValue) { return getLocalName((XmlAttributeValue)o); } return null; } }); }