<h:html xmlns="http://www.w3.org/2002/xforms" 
    xmlns:ev="http://www.w3.org/2001/xml-events" 
    xmlns:h="http://www.w3.org/1999/xhtml" 
    xmlns:jr="http://openrosa.org/javarosa" 
    xmlns:orx="http://openrosa.org/xforms" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <h:head>
        <h:title>Nested Repeats</h:title>
        <model>
            <instance>
                <data id="data">
                    <kids>
                        <has-kids>1</has-kids>
                        <kids-details jr:template="">
                            <kids-name/>
                            <immunization-info jr:template="">
                                <vaccine/>
                                <immunization-info-details jr:template="">
                                    <something/>
                                </immunization-info-details>
                            </immunization-info>
                        </kids-details>
                        <group>
                            <nested-age/>
                        </group>
                    </kids>
                    <gps/>
                    <repeat jr:template="">
                        <b/>
                    </repeat>
                    <repeat-confusion jr:template="">
                        <a/>
                    </repeat-confusion>
                    <orx:meta>
                        <orx:instanceID/>
                    </orx:meta>
                </data>
            </instance>
            <bind nodeset="/data/kids/has-kids" type="select1"/>
            <bind nodeset="/data/kids/kids-details" relevant="/data/kids/has-kids='1'"/>
            <bind nodeset="/data/kids/kids-details/kids-name" type="string"/>
            <bind nodeset="/data/kids/kids-details/immunization-info/vaccine" type="string"/>
            <bind nodeset="/data/kids/group/nested-age" type="int"/>
        </model>
    </h:head>
    <h:body>
        <group ref="/data/kids">
            <label>Kids</label>
            <select1 ref="/data/kids/has-kids">
                <label>4. Do you have any kids?</label>
                <item>
                    <label>yes</label>
                    <value>1</value>
                </item>
            </select1>
            <group ref="/data/kids/kids-details">
                <label>4.1 Kids Details</label>
                <repeat nodeset="/data/kids/kids-details">
                    <input ref="/data/kids/kids-details/kids-name">
                        <label>4.1.1 Child's Name</label>
                    </input>
                    <group ref="/data/kids/kids-details/immunization-info">
                        <label></label>
                        <repeat nodeset="/data/kids/kids-details/immunization-info">
                            <input ref="/data/kids/kids-details/immunization-info/vaccine">
                                <label>An immunization record</label>
                            </input>
                            <group ref="/data/kids/kids-details/immunization-info/immunization-info-details">
                                <repeat nodeset="/data/kids/kids-details/immunization-info/immunization-info-details">
                                    <input ref="/data/kids/kids-details/immunization-info/immunization-info-details/something">
                                        <label>Something</label>
                                    </input>
                                </repeat>
                            </group>
                        </repeat>
                    </group>
                </repeat>
            </group>
            <group ref="/data/kids/group">
                <label>4.2 A Nested Group</label>
                <input ref="/data/kids/group/nested-age">
                    <label>4.4 A Nested Age</label>
                </input>
            </group>
        </group>
        <group ref="/data/repeat">
            <repeat nodeset="/data/repeat">
                <input ref="/data/repeat/a">
                    <label>a</label>
                </input>
            </repeat>
        </group>
        <!-- not a nested repeat, but in the past was identified as one -->
        <group ref="/data/repeat-confusion">
            <repeat nodeset="/data/repeat-confusion">
                <input ref="/data/repeat-confusion/b">
                    <label>a</label>
                </input>
            </repeat>
        </group>
    </h:body>
</h:html>
