Share via


3.4.1.12 Repeating Table Control

The following XSL examples are repeating table controls, as specified in section 2.3.1.12.

The following example is a repeating table control that has three columns containing a text box control, as specified in section 2.3.1.16, inside each column (2). The repeating table also outputs a link with the text "Insert Item" that adds an additional row to the repeating table after clicking this link.

 <div>
     <table class="xdRepeatingTable msoUcTable" title="" style="TABLE-LAYOUT: fixed; WIDTH: 651px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-COLLAPSE: collapse; WORD-WRAP: break-word; BORDER-BOTTOM-STYLE: none" border="1" xd:CtrlId="CTRL12">
         <colgroup>
             <col style="WIDTH: 210px" /> 
             <col style="WIDTH: 211px" /> 
             <col style="WIDTH: 230px" /> 
         </colgroup>
         <tbody class="xdTableHeader">
             <tr>
                 <td>
                     <div>
                         <strong /> 
                     </div>
                 </td>
                 <td>
                     <div>
                         <strong /> 
                     </div>
                 </td>
                 <td>
                     <div>
                         <strong /> 
                     </div>
                 </td>
             </tr>
         </tbody>
         <tbody xd:xctname="RepeatingTable">
             <xsl:for-each select="my:group1/my:group2">
                 <tr>
                     <td>
                         <span class="xdTextBox" hideFocus="1" title="" xd:binding="my:field5" xd:xctname="PlainText" tabIndex="0" xd:CtrlId="CTRL13" style="WIDTH: 100%">
                             <xsl:value-of select="my:field5" /> 
                         </span>
                     </td>
                     <td>
                         <span class="xdTextBox" hideFocus="1" title="" xd:binding="my:field6" xd:xctname="PlainText" tabIndex="0" xd:CtrlId="CTRL14" style="WIDTH: 100%">
                             <xsl:value-of select="my:field6" /> 
                         </span>
                     </td>
                     <td>
                         <span class="xdTextBox" hideFocus="1" title="" xd:binding="my:field7" xd:xctname="PlainText" tabIndex="0" xd:CtrlId="CTRL15" style="WIDTH: 100%">
                             <xsl:value-of select="my:field7" /> 
                         </span>
                     </td>
                 </tr>
             </xsl:for-each>
         </tbody>
 </table>
 <div class="optionalPlaceholder" xd:xmlToEdit="group2_8" tabIndex="0" xd:action="xCollection::insert" style="WIDTH: 651px">Insert item</div> 
 </div>

The following example is a repeating table control that has three columns containing a text box control inside each column. This repeating table also contains a footer. Conditional formatting is set such that if the value of my:field8 is "2", the control has a different background color. This control also causes a postback whenever a table row is inserted or removed.

 <div>
     <table class="xdRepeatingTable msoUcTable" title="" style="TABLE-LAYOUT: fixed; WIDTH: 651px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-COLLAPSE: collapse; WORD-WRAP: break-word; BORDER-BOTTOM-STYLE: none" border="1" xd:CtrlId="CTRL16" xd:postbackModel="always">
         <colgroup>
             <col style="WIDTH: 210px" /> 
             <col style="WIDTH: 211px" /> 
             <col style="WIDTH: 230px" /> 
         </colgroup>
         <tbody class="xdTableHeader">
             <tr>
                 <td>
                     <div>
                         <strong /> 
                     </div>
                 </td>
                 <td>
                     <div>
                         <strong />
                     </div>
                 </td>
                 <td>
                     <div>
                         <strong /> 
                     </div>
                 </td>
             </tr>
         </tbody>
         <tbody xd:xctname="RepeatingTable">
             <xsl:for-each select="my:group3/my:group4">
                 <xsl:if test="not((my:field8 = quot;1quot;))">
                     <tr>
                         <xsl:attribute name="style">
                             <xsl:choose>
                                 <xsl:when test="my:field8 = 2">BACKGROUND-COLOR: #ff00ff</xsl:when> 
                             </xsl:choose>
                         </xsl:attribute>
                         <td>
                             <span class="xdTextBox" hideFocus="1" title="" xd:binding="my:field8" xd:xctname="PlainText" tabIndex="0" xd:CtrlId="CTRL17" style="WIDTH: 100%">
                                 <xsl:value-of select="my:field8" /> 
                             </span>
                         </td>
                         <td>
                             <span class="xdTextBox" hideFocus="1" title="" xd:binding="my:field9" xd:xctname="PlainText" tabIndex="0" xd:CtrlId="CTRL18" style="WIDTH: 100%">
                                 <xsl:value-of select="my:field9" /> 
                             </span>
                         </td>
                         <td>
                             <span class="xdTextBox" hideFocus="1" title="" xd:binding="my:field10" xd:xctname="PlainText" tabIndex="0" xd:CtrlId="CTRL19" style="WIDTH: 100%">
                                 <xsl:value-of select="my:field10" /> 
                             </span>
                         </td>
                     </tr>
                 </xsl:if>
             </xsl:for-each>
         </tbody>
         <tbody class="xdTableFooter">
             <tr>
                 <td>
                     <div> </div> 
                 </td>
                 <td>
                     <div> </div> 
                 </td>
                 <td>
                     <div> </div> 
                 </td>
             </tr>
         </tbody>
     </table>
 </div>

The following example is a repeating table control that has one column with a text box inside. Conditional formatting is set such that if the value of my:field1 is "1", the control does not allow the user to insert or delete rows from the table. Note that this conditional formatting is placed outside the repeating table element.

 <span>
     <xsl:attribute name="style">
         <xsl:if test="my:field1 = &quot;1&quot;">msos-xCollection-group8_16-editing:disabled;</xsl:if> 
     </xsl:attribute>
     <div>
         <table class="xdRepeatingTable msoUcTable" title="" style="TABLE-LAYOUT: fixed; WIDTH: 651px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-COLLAPSE: collapse; WORD-WRAP: break-word; BORDER-BOTTOM-STYLE: none" border="1" xd:CtrlId="CTRL24">
             <colgroup>
                 <col style="WIDTH: 651px" /> 
             </colgroup>
         <tbody class="xdTableHeader">
             <tr>
                 <td>
                     <div>
                         <strong />  
                     </div>
                 </td>
             </tr>
         </tbody>
         <tbody xd:xctname="RepeatingTable">
             <xsl:for-each select="my:group7/my:group8">
                 <tr>
                     <td>
                         <span class="xdTextBox" hideFocus="1" title="" xd:binding="my:field14" xd:xctname="PlainText" tabIndex="0" xd:CtrlId="CTRL25" style="WIDTH: 100%">
                             <xsl:value-of select="my:field14" /> 
                         </span>
                     </td>
                 </tr>
             </xsl:for-each>
         </tbody>
     </table>
     <div class="optionalPlaceholder" xd:xmlToEdit="group8_16" tabIndex="0" xd:action="xCollection::insert" style="WIDTH: 651px">Insert item</div> 
     </div>
 </span>