When the multiple node has a coalesce field with an id defined, we should use this information to find the correct parent.
The key will be to translate this id into a filter when building the xpath for finding matching nodes in the trusted doc (and therefore the correct parent.) this means that we need to find the parent for each source doc match separately instead of the rule as a whole, and we need to get the value for the id field from the hierarchy of that source node match.
a better way to achieve this might be to process rules as part of the "subtree merge". this would require a major change to the algorithm, but it might get us everything we need.
When the multiple node has a coalesce field with an id defined, we should use this information to find the correct parent.
The key will be to translate this id into a filter when building the xpath for finding matching nodes in the trusted doc (and therefore the correct parent.) this means that we need to find the parent for each source doc match separately instead of the rule as a whole, and we need to get the value for the id field from the hierarchy of that source node match.
a better way to achieve this might be to process rules as part of the "subtree merge". this would require a major change to the algorithm, but it might get us everything we need.