One of the main usage for xdtl:for is looping thought a rowset that came from xdtl:fetch. Observe
<xdtl:fetch source="SELECT object_id, object_nm FROM MD_OBJECT WHERE object_type_cd = 1" rowset="metamodels" connection="$cn" />
<xdtl:for item="metamodel" rowset="metamodels">
<xdtl:log msg="Found metamodel named ${metamodel[1]} with id ${metamodel[0]}" />
</xdtl:for>
Before we get to the point, one little thing. Check if returned rowset is not empty:
<xdtl:if expr="${metamodel.isEmpty()">
<xdtl:error msg="No metamodels found" />
</xdtl:if>
Often the rowset may be defined in a input parameter as a coma-separated list. In that case you still can loop through it by using Java split function. Observe, that you have to convert the splited array into list of arrays:
<xdtl:send source="Metamodel1,Metamodel2,Metamodel3" target="metamodel_list" overwrite="1" />
<xdtl:for rowset="${java.util.Arrays.asList(metamodel_list.split(/,/))}">
<xdtl:log msg="Found metamodel named ${metamodel[0]}" />
</xdtl:for>