{
xmlNode *next_child;
for (xmlNode *child = node->children; child != NULL; child = next_child) {
- next_child = child->next;
- bool processed = false;
+ next_child = child->next;
+ Directive *next_processor = this;
if (child->type == XML_ELEMENT_NODE) {
// Find the ID, if any.
xmlSetProp(child, attr_key, attr_value);
}
- if (processed) {
- continue;
- }
-
- // Regular substitution.
+ // Regular substitution. (Don't call process() immediately, because
+ // that might delete the element, which would cause problems.)
if (it.first == tag ||
(!id.empty() && it.first == ("#" + id))) {
- it.second->process(child, clean);
- processed = true;
+ next_processor = it.second;
}
}
}
- if (!processed) {
- process(child, clean);
- }
+ next_processor->process(child, clean);
}
if (clean) {
clean_node(node);