repeat instruction

For a specified collection, iterate through the collection and repeat the element, once per item in the collection.

Syntax

<tag gwc:repeat="elt eltList">
    statements 
</tag>
Note:
  1. eltList is the list of elements to loop on (the collection of elements)
  2. elt is an element of eltList
  3. statements are statements repeated for each element elt in the collection eltList
  4. See repeat template paths for special template paths used with a gwc:repeat instruction

Example

<div gwc:repeat="item menu/actions">
  <a href="..." gwc:condition="item/text"
    gwc:define="text item/text"      
    gwc:attributes="href document/URL + '?' + item/IDID" 
    gwc:content="text">Input</a>
</div>

Displays the text of each action of a menu as an HTML link.

Repeat instruction template paths

The following table lists special template paths for use with a gwc:repeat instruction. For more information on template paths, see Template Paths for the Snippet-Based Rendering Engine.

Table 1. gwc:repeat template paths I
Template Path Type Component AUI object
repeat object    
repeat/elt object    
Table 2. gwc:repeat template paths II
Template Path Type Description Attribute Type
repeat/elt/length attribute Get the length of the repeat sequence (the number of elements in the sequence). number
repeat/elt/index attribute Get the index of the current element in the sequence, starting with 0 (zero). number
repeat/elt/first attribute Test if the current repeat element is the first element of the sequence boolean
repeat/elt/last attribute Test if the current repeat element is the last element of the sequence boolean
repeat/elt/even attribute Test if the current repeat element is an even element of the sequence boolean
repeat/elt/odd attribute Test if the current repeat element is an odd element of the sequence boolean
Note:
  1. elt is a repeat instruction element.