I have not been able to implement a master-detail Template Component to create a region like this (with collapsible details):

Note: this is a screenshot from an APEX application. I created this report as a Dynamic Content region, so it is possible in APEX!
I would like to make this reusable, as a Template Component. However, I haven't been able to create the nested loop (EMP) inside the Partial template (DEPT) of the Template Component.
Is that even possible?