Cernunnos Manual


<for-each>

Description:

Iterates over the elements in ITEMS, performing SUBTASKS once for each item.

Reagents:

Name XPath Description Reagent Type Expected Type Required
ATTRIBUTE_NAME @attribute-name Optional name under which each item will be registered as a request attribute. If omitted, the name 'Attributes.OBJECT' will be used. PHRASE java.lang.String No
ITEMS @items Items that will be iterated over; specify either an instance of java.lang.Iterable, java.util.Enumeration, java.util.Iterator, or an array. If omitted, this task will use the value of the 'Attributes.OBJECT' request attribute. PHRASE java.lang.Object No
SUBTASKS * The set of tasks that are children of this task. NODE_LIST java.util.List No

Examples:

Invokes the 'go-to-south-park.crn' file once for each of the specified characters:

 
       
        <for-each items="${groovy(['Stan', 'Kyle', 'Cartman', 'Kenny'])}"> 
          <crn location="go-to-south-park.crn"/> 
        </for-each>