I have the following XML source structure:
In plain XSLT 1.0 you need a recursive template for this, for example: