3.22. if

Element typeif
Attributescond
Parentsblock | catch | error | filled | help | if | noinput | nomatch
Childrenassign | audio | clear | disconnect | else | elseif | enumerate | exit | goto | if | log | prompt | reprompt | return | script | submit | throw | value | var
DescriptionAn executable element implementing the if-then-else conditional logic.

DTD

<!ENTITY % if.attrs 
  "cond  %expression; #REQUIRED" >

<!ELEMENT if (%executable.content; | elseif | else)* >
<!ATTLIST if
  %if.attrs; >

Language model



Attributes

cond : expression

An ECMAScript expression that evaluates to a boolean. If it evaluates to true, the contents within the if element will be executed until an elseif or else element is encountered or the closing </if> tag is encountered.

Children

elseif elements

Marks the beginning of an else-if code block within this if element.

else element

Marks the beginning of the else code block within this if element.

executable.content

Elements and audible nodes that may be executed depending on the evaluation of this if element's cond attribute, the cond attributes of sibling elseif elements, and their position relative to sibling elseif and else elements.

Examples

Example 3-25. A form demonstrating if-else logic
<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="1.0">
  <form id="pick">
    <field name="select">  
      <grammar>one|two|three</grammar>
      <prompt>Pick a number from one to three.</prompt>
      <filled>
        <if cond="select=='one'">
          <prompt>Your selection was one.</prompt>
          <else/>
          <prompt>Your selection was greater than one.</prompt>
        </if>
      </filled>
    </field>
  </form>
</vxml>

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.242.118