Nifty - Varying element count

Back to my xml question.
how would i do this ?

<?xml version="1.0" encoding="UTF-8"?>
<nifty-controls>
    <controlDefinition name="planetButtonArea">
        <!-- panel planetButtons shows the planets and a visit button to visit the selected planet -->
        <panel id="panel_planetButtons" height="85%" width="20%" childLayout="vertical" align="left"   
               backgroundImage = "Interface/purple.png" imageMode="resize:48,4,48,48,48,4,48,4,48,4,48,48">  
            <!-- panel for the title of this area -->
            <panel id="panel_planetButtonsTitle" height="8%" width="100%" valign="top" childLayout="center">  
                <text text="${stars.solarSystem}" font="Interface/fonts/28DaysLater.fnt" width="100%" height="100%"/>
                <effect><onStartScreen inherit="true" name="fade" length="1300" neverStopRendering="true"/></effect>                        
            </panel>                         
            <!-- panel for the planets of this system -->
            
<!-- @TODO Section start -->                        
            <panel id="panel_obj1" height="8%" width="100%" valign="top" childLayout="center"
                   backgroundImage = "Interface/blackborder.png" imageMode="resize:15,2,15,15,15,2,15,2,15,2,15,15">  
                <control name="button" label="${stars.sun}" id="sunButton" align="center" valign="center" visibleToMouse="true"> 
                    <interact onClick="selectPlanet(0)" />
                </control>
                <effect><onStartScreen inherit="true" name="fade" length="1300" neverStopRendering="true"/></effect>                        
            </panel>
             .
             .
             .
             .
            <panel id="panel_objn" height="8%" width="100%" valign="top" childLayout="center"
                   backgroundImage = "Interface/blackborder.png" imageMode="resize:15,2,15,15,15,2,15,2,15,2,15,15">  
                <control name="button" label="${stars.starN}" id="planetNButton" align="center" valign="center" visibleToMouse="true"> 
                    <interact onClick="selectPlanet(n)" />
                </control>
                <effect><onStartScreen inherit="true" name="fade" length="1300" neverStopRendering="true"/></effect>                        
            </panel>                                        
        </panel>        
    </controlDefinition>
</nifty-controls>

What if i wanted to build that panel with a different count of buttons, defined by what and how many objects are given in the application.