Keep consistent ordering of import document heads and bodies