item 11 item 12 item 13 item 14 item 15 item 21 item 22 item 23 item 24 item 25 item 31 item 32 item 33 item 34 item 35 Label 1 Label 2 Label 3 Label 4 Label 5

CSS
Hover the classes to see matching element(s) in the example
xfContainer matches any Element that represents a XForms group | repeat | switch element
xfRepeatItem matches all repeat items
xfRepeatIndex matches the currently selected repeat item
xfTbody matches the element wearing the repeat attributes
one matches a cells that have the author class 'one' on them
two matches a cells that have the author class 'two' on them
three matches a cells that have the author class 'three' on them
four matches a cells that have the author class 'four' on them
five matches a cells that have the author class 'five' on them
xfControl matches an Element that represents a XForms control
xfLabel matches the label part of an XForms control
xfValue matches the widget part of an XForms control

# Table via repeat attributes

This form shows usage of repeat attributes in conjunction with a HTML table.

Please note that this example uses output controls for the table header which are bound to a separate instance. This allows to internationalize the labels if you need to but it is no requirement for working with repeat attributes.

| XForms 1.1 Links
Recommendation
Quick Reference

## Example

insert delete

## XForms Markup

    <xf:instance>
        <data>
            <items>
                <item1>item 11</item1>
                <item2>item 12</item2>
                <item3>item 13</item3>
                <item4>item 14</item4>
                <item5>item 15</item5>
            </items>
            <items>
                <item1>item 21</item1>
                <item2>item 22</item2>
                <item3>item 23</item3>
                <item4>item 24</item4>
                <item5>item 25</item5>
            </items>
            <items>
                <item1>item 31</item1>
                <item2>item 32</item2>
                <item3>item 33</item3>
                <item4>item 34</item4>
                <item5>item 35</item5>
            </items>
        </data>
    </xf:instance>

    <xf:instance id="labels">
        <data>
            <item1>Label 1</item1>
            <item2>Label 2</item2>
            <item3>Label 3</item3>
            <item4>Label 4</item4>
            <item5>Label 5</item5>
        </data>
    </xf:instance>

    <xf:trigger>
        <xf:label>insert</xf:label>
        <xf:action>
            <xf:insert nodeset="items"></xf:insert>
        </xf:action>
    </xf:trigger>

    <xf:trigger>
        <xf:label>delete</xf:label>
        <xf:action>
            <xf:delete nodeset="items[index('r-attrs')]"></xf:delete>
        </xf:action>
    </xf:trigger>

    <table>
        <thead>
            <tr>
                <th>
                    <xf:output ref="instance('labels')/item1"></xf:output>
                </th>
                <th>
                    <xf:output ref="instance('labels')/item2"></xf:output>
                </th>
                <th>
                    <xf:output ref="instance('labels')/item3"></xf:output>
                </th>
                <th>
                    <xf:output ref="instance('labels')/item4"></xf:output>
                </th>
                <th>
                    <xf:output ref="instance('labels')/item5"></xf:output>
                </th>
            </tr>
        </thead>
        <tbody id="r-attrs" xf:repeat-nodeset="items">
            <tr>
                <td id="foo" class="one" style="color:steelblue;font-weight:bold;">
                    <xf:output ref="item1"></xf:output>
                </td>
                <td class="two" style="color:blue;">
                    <xf:output ref="item2"></xf:output>
                </td>
                <td class="three" style="color:blue;">
                    <xf:output ref="item3"></xf:output>
                </td>
                <td class="four" style="color:blue;">
                    <xf:output ref="item4"></xf:output>
                </td>
                <td class="five" style="color:blue;">
                    <xf:output ref="item5"></xf:output>
                </td>
            </tr>
        </tbody>

    </table>

## Notes

Please note that if you use a display:block for class xfContainer you should add a rule