You could do it in Workflow using the XSLT plugin, provided that you understand XSLT syntax.
If you want to do it in the Datamapper, IT can be done in the Preprocessor using a script.
I do it for JSON data which is a lot easier. You could as well convert your XML data to a JSON format and then do the sorting in the Datamapper
Find attached a Datamapper example of JSON sorting on 2 fields. It was done in Connect 2021.2.1. It was initially a XMLfile that I converted to JSON format using the XML/JSON Conversion plugin in Workflow.
Simply look at the result in the Datamodel. Notice the order of the 5 records based on the extraction if Country and State.
Then go in the Preprocessor’s script, tick the checkbox next to it and click on the green arrow on the right side.
Then go back to check the new order of the records.
Note that in my example, the sorting is done on the JSON objects inside of a array.
sortJSON2Level.OL-datamapper (5.8 KB)