Error message:
XML tag ID 4 that was originally declared as Aaaaa is being redeclared as Bbbbb.
Cause and solution:
Each group of data should be declared in other tag.
In this case, there were 2 groups with tag 4: [Aaaaa!4!CollectionID] and [Bbbbb!4!CollectionID].
The solution was to create new tag to the new group: [Bbbbb!13!CollectionID].
Of course that I had to add new UNION select in order to select the data of Bbbbb and to assign it to a parent.