I have an xml in the following format;
.
.
.
.
stdate1
endate1
It's good practice to use many templates rather then one with "hidden" elements.
BasePeriod:
Periods
Period:
Sub Periods
subperiod:
expandIt:
As you see I changed:
to:
(same for per_expand). Result (using Opera):

Next (clicking Periods link):

Next (clicking sub periods):

It seems to be ok, expanding and collapsing work as expected.