XML sort

how can I sort an xml doc by the “name” node?

read it into an array, sort it and rebuild it…