XmlAttributeValuePattern (ElementPattern<String> namePattern) { return with(new PsiNamePatternCondition<>("withNamespace", namePattern) { @Override public String getPropertyValue(@NotNull final Object o) { if (o instanceof XmlAttributeValue) { final PsiElement parent = ((XmlAttributeValue)o).getParent(); if (parent instanceof XmlAttribute) { return ((XmlAttribute)parent).getNamespace(); } } return null; } }); }