Home > Articles > Web Services > XML

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

3.9 else

Element type

else

Attributes

None.

Parents

if

Children

None.

Description

Declares the beginning of the "else code" within an if element. All elements within the if element after the else element are executed only if the if element's cond attribute and its contained elseif elements' cond attributes all evaluate to false.

DTD

<!ELEMENT else EMPTY >

Language model


03mod09.gif


Attributes

None.

Children

None.

Examples

Example 3-11 Using the 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>
          <elseif cond="select=='two'"/>
          <prompt>Your selection was two.</prompt>
          <else/>
          <prompt>Your selection was three.</prompt>
        </if>
      </filled>
    </field>
  </form>
</vxml>
  • + Share This
  • 🔖 Save To Your Account