At first you have to make all the document lists including recursive documentlist as temporary documents and inside the loop (OutputDoc)when you are done with mapping as a last step use appendToDocumentList and map the tmp documents(childList,childList,OutputDoc) to the final doucmentlist OutputDoc(childList,childList).
Loop over InputDoc.
Map InputDoc->value1 to OutputDoc->value1 and InputDoc->value2 to OutputDoc->value2
Map OutputDoc to OutputDoc->OutputDoc (OutputDoc structure now will be OutputDoc->value1, value2, OutputDoc)
End of Loop
At the end of the loop, the required record will be available within the OutputDoc structure.
Is it possible to make a more dynamic solution. I don’t know the size of the InputDoc (it could be from 1 to 30 documents inside, so that the OutputDoc can contain many child lists) Ex.