E node = substrate.asElement(currentContainer.getValue());
Attributes oldAttributes = new AttributesImpl(substrate.getAttributes(node));
// Iterate over oldAttributes here, not attributeMap, since we are modifying
// the map underlying the latter.
for (Map.Entry<String, String> attribute : oldAttributes.entrySet()) {
String key = attribute.getKey();
if (!newAttrs.containsKey(key)) {
substrate.removeAttribute(node, attribute.getKey());
}
}