I would recommend saving a copy of the default XSI layout, load it up in an XML editor, and search for optional=“hidden” and optional=“visible” to see where it’s used. Both commands set up Folding panels, visible sets it to unfolded by default, hidden sets the folding panel to folded by default.
The other code you listed does not appear anywhere but it should work, it’s for making containers…
I see you've also posted this at XSI base. They gave you some links there to answer your question, and you know, they're right.
Explains how to do exactly what your asking, I used that tutorial myself to understand how to edit the .XML layouts by hand and it worked perfectly. If you go through that, you should be able to make folding menus or menus with built in containers by the end of it.