The loop initialization is done by mapping data from in ports to inLoop ports using the 'init' attribute. Each iteration produces data on outLoop ports according to the assignments of the <do> tag (semi-column separated list of assignments). The outputs of the processors that are iterated can be connected to the inLoop ports when the results of one iteration are used by the next one (but this is not mandatory). When the while condition is evaluated to false, the outLoop data items are handed over to the corresponding out ports according to the 'final' attribute of these. They are then sent to the connected processors.
Finally for one instance of this while processor, iterations are done for processors connected to the outLoop ports and one data item is produced by the out port(s).
<loop name="WHILE_Example"> <!-- REQUIRED nb of IN ports EQUALS nb of OUT ports --> <in name="v" type="double" /> <out name="out" type="double" /> <inLoop name="v_l" type="double" init="v"/> <outLoop name="l" type="double" final="out"/> <!-- WHILE Condition must be written in XQuery language --> <!-- it can contain ONLY LOOP IN ports --> <while>$v lt 100</while> <!-- DO maps the inLoop ports to the outLoop ports - straightforward --> <do>l=v_l;</do> </loop>