in order to do so you should split the stream into two. One edge for parent records (deduplicated parent fields) and the second for child elements. In XMLWriter, you can use Key and Parent Key elements on bindings. For more information please refer to our documentation - especially to Example 41.17.
I have also prepared simple example for your case (see attached project).