You are using tXMLMap, and tXMLMap supports multiple loop element, so you should define the XML tree on tXMLMap, not tAdvancedOutputXML, tAdvancedOutputXML don't support multiple loop elements. on tXMLMap, add a new column with Document type, and then define the xml tree. see pic1.
To generate the result as a XML file, link it to a tFileOutputXML and check the 'incoming record is a document' box.
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Learn how to do cool things with Context Variables
Find out how to migrate from one database to another using the Dynamic schema
Pick up some tips and tricks with Context Variables