Say there are two overlays placesOverlay.xul and macBrowserOverlay.xul and a master document aboutDialog.xul. The relationship is: aboutDialog.xul includes macBrowserOverlay.xul and macBrowserOverlay.xul includes placesOverlay.xul.
placesOverlay.xul
<commandset id="zzz">
<command id="zzzPlacesOverlay"/>
</commandset>
macBrowserOverlay.xul
<?xul-overlay href="placesOverlay.xul"?>
aboutDialog.xul
<?xul-overlay href="macBrowserOverlay.xul"?>
<commandset id="zzz">
<command id="zzzAboutDialog"/>
</commandset>
The resulting aboutDialog.xul would be:
<commandset id="zzz">
<command id="zzzAboutDialog"/>
<command id="zzzPlacesOverlay"/>
</commandset>
Key takeaway: overalys within overlays apply to the master document. The top level overaly does not just apply to the overlay that includes it.
Let's say the macBrowserOverlay.xul also defines a <commandset id="zzz">
.
macBrowserOverlay.xul
<?xul-overlay href="placesOverlay.xul"?>
<commandset id="zzz">
<command id="zzzMacBrowserOverlay"/>
</commandset>
The result would be:
<commandset id="zzz">
<command id="zzzAboutDialog"/>
<command id="zzzMacBrowserOverlay"/>
<command id="zzzPlacesOverlay"/>
</commandset>
Key takeaway: overalys are applied bottom up.