After cursory investigation I think this may be caused by perspectives not being duplicated correctly. A quick solution would be to put additional ID conflict resolution code in id-clashes.cpp. However, the whole premise of enumerating stuff that can conflict in id-clashes.cpp is wrong and the correct long-term solution is to make the XML tree CSS-aware so it can keep track of what references what and change IDs without breaking references.
After cursory investigation I think this may be caused by perspectives not being duplicated correctly. A quick solution would be to put additional ID conflict resolution code in id-clashes.cpp. However, the whole premise of enumerating stuff that can conflict in id-clashes.cpp is wrong and the correct long-term solution is to make the XML tree CSS-aware so it can keep track of what references what and change IDs without breaking references.