So finally there's someone with a taste for good music
Anyways: If I get you correctly, you have an input flat file that already has an order which groups together bands and titles, right?
Why do you need the "target XML file" to be flat as well? You could, as Praveen has shown in the link, instantly create a deep nested XML after (graphical) mapping without the need for keys, like so:
<document> <band> <bandName>Metallica</bandName> <title>Nothing else matters</title> <title>Enter Sandman</title> </band> <band> <bandName>ACDC</bandName> <title>Highway to hell</title> <title>Back in black</title> </band></document>
If you need to obey the root structure of the "target XML file" and only could add nodes on a sub-node level (like the "key" node you introduced), then only you would need to go through the troubles of computing a key field.
Cheers
Jens