Fix XML node selector loop issue