if (!(node instanceof NestableAttributeHolderNode)) {
return false;
}
final NestableAttributeHolderNode attributeHolderNode = (NestableAttributeHolderNode) node;
final String prefix = context.getDialectPrefix();
if (!attributeHolderNode.hasNormalizedAttribute(prefix, this.attributeName)) {
return false;
}
if (this.elementNameFilter != null) {
if (attributeHolderNode instanceof Element) {
final Element element = (Element) attributeHolderNode;
if (!element.getNormalizedName().equals(this.elementNameFilter)) {
return false;
}
} else {
// if node is not an element (because it probably is a group of nodes, it has no
// "element/tag name", and therefore does not match if this matcher specifies one.
return false;
}
}
if (this.attributeValuesByNameFilter != null) {
for (final Map.Entry<String,String> filterAttributeEntry : this.attributeValuesByNameFilter.entrySet()) {
final String filterAttributeName = filterAttributeEntry.getKey();
final String filterAttributeValue = filterAttributeEntry.getValue();
if (!attributeHolderNode.hasAttribute(filterAttributeName)) {
if (filterAttributeValue != null) {
return false;
}
continue;
}
final String elementAttributeValue = attributeHolderNode.getAttributeValue(filterAttributeName);
if (elementAttributeValue == null) {
if (filterAttributeValue != null) {
return false;
}
} else {