4.2. Repeat (element)

<repeat> ‐ A repeat macro-command

4.2.1. Attributes

NameTypeDefaults
idSTRINGNone (required)
beginINTEGERNone (required)
endINTEGERNone (required)
stepINTEGERNone (required)

4.2.2. Description

The <repeat> macro-command is used at compile-time to copy several instances of the XML code contained between the opening <repeat> and closing </repeat> markups. Each repeat element is associated with a parameter that can be referenced in the strings and in the numerical expressions inside the scope of the <repeat> markup.

4.2.3. Expected children

One of the following elements must occur in repeat element: node or use.

4.2.4. Example

The following example shows two embedded <repeat> macro-commands and the use of their parameters n and k:

<repeat begin="0" end="12" step="1" id="n">
  <node id="sea_{#n}">
    <transformation id="transf{#n}"
      geometry="translation" x="(8 + ({#n} * 2))" y="0.0" z="0.0"/> 
    <repeat begin="2" end="8" step="2" id="k">
      <node id="sea_wave_{#n}.{#k}">
        <transformation id="transf{#n}"
          geometry="translation" x="({#k} * 0.25)" y="0.0" z="0.0"/> 
        <node id = "sail">
        </node>
      </node>
    </repeat>
  </node>
</repeat>