<while>
This looping statement processes any children statements in a repeated loop as long as its specified condition remains true or until a <break> statement is executed. You can use most EMML statements within <while>. You can also use <break> to explictly stop further loop processing.
See also <while> Example.
| Can Contain | ( Statements Group | ( Variables Group ) | ( ( macro:custom-macro-name | any element in a non-EMML namespace )* ) | ( break ) | ( variables ) )+ |
| Allowed In | mashup, else, elseif, for, foreach, if, macro, operation, sequence, while, |
Attributes
| Name | Required | Description |
|---|---|---|
| condition | yes | An expression for the condition to test at the beginning or each <while> statement loop. |
<while> Example
You must specify the condition that must be true for the <while> loop to process. Then add statements, as needed, within <while>. For example:
<variables>
<variable name="orders" type="document"/>
<variable name="subtotal" type="number"/>
<variable name="taxes" type="document"/>
</variables>
...
<foreach variable="$order" items="$orders//invoice">
<while condition="$order/item/tax > 0">
<appendresult outputvariable="$taxes">
<res:order>
<res:id>{$order/invoiceNo)}</res:id>
<res:item>{$order/item/itemNo}</res:item>
<res:tax>{$order/item/tax}</res:tax>
</res:order>
</while>
</appendResult>
</for>
You can also set the condition to always be true and then explicitly break out of the loop. For an example, see the <break> statement.
Enterprise Mashup Markup Language (EMML) Documentation is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.
