Iterates over the elements of an array.
<foreach
item="string"
array="string"
>
Executable Content
</bevocal:foreach>
The interpreter sets the iteration variable to each element of the array, in turn, and executes the contained elements once for each setting of the iteration variable.
| Attribute | Description |
item |
Name of the iteration variable, which may not be a JavaScript reserved keyword. The scope of the iteration variable is the |
array |
<?xml version="1.0" ?>
<!DOCTYPE vxml PUBLIC "-//BeVocal Inc//VoiceXML 2.0//EN"
"http://cafe.bevocal.com/libraries/dtd/vxml2-0-bevocal.dtd">
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
<form id="form1">
<block>
<!-- create an array of services -->
<var name="serviceNames"
expr="new Array('news', 'weather', 'traffic')"/>
<prompt>Here's a list of services </prompt>
<!-- iterate through each item in the services array -->
<foreach item="service" array="serviceNames">
<!-- Say the current array element -->
<prompt><value expr="service"/> <break size="small"/></prompt>
</foreach>
</block>
</form>
</vxml>
| Café Home |
Developer Agreement |
Privacy Policy |
Site Map |
Terms & Conditions Part No. 520-0001-02 | © 1999-2007, BeVocal, Inc. All rights reserved | 1.877.33.VOCAL |