Good question. Originally the below snip applied, but I don't see how it can possible apply these days. Can you swear allegiance only as long as you're excluding everything anti-Catholic?
5:37 "...it is part of the Christian tradition that as the Roman Empire was dismantled, that throughout Europe the Christian Monarchies arose, and all of those Christian Kings recognized that they were to take Christ as their model.
They were to think of themselves as the vicegerents of Christ, just as the pope was the vicar of Christ upon the earth. And the people were taught they had two sovereigns on the earth, but both of them did represent Christ. The pope represented Christ in the spiritual realm, and the king represented Christ in matter temporal, and the people were to obey both as a religious duty..." - Fr. Wathen