<one-of>

A <one-of> block specifies a set of alternative legal rule expansions each of which is contained within an <item> block.

Attributes

xml:lang (defaults to "xml:lang" global property or the "xml:lang" attribute of the <grammar> tag) The language identifier as defined in RFC3066.

Notes

For examples and usage information, please refer to the Speech Recognition Grammar Specification.


Example

<?xml version="1.0"?>
<vxml version="2.0">

  <form>
    <grammar type="application/srgs+xml" root="ROOT" mode="voice">
      <rule id="ROOT">
        <one-of>
          <item>
            Dog
            <tag>
              name="Lassie";age="5";color="brown"
            </tag>
          </item>
          <item>
            Cat
            <tag>
              name="Garfield";age="7";color="orange"
            </tag>
          </item>
        </one-of>
      </rule>
    </grammar>

    <initial>
      <prompt>
        Say either dog or cat.
      </prompt>
    </initial>

    <field name="name"/>
    <field name="age"/>
    <field name="color"/>

    <filled>
      <if cond="name=='Lassie'">
        <prompt>
          The dog's name is <value expr="name"/>.
          He is <value expr="age"/> years old.
          His fur color is <value expr="color"/>.
        </prompt>
        <elseif cond="name=='Garfield'"/>
        <prompt>
          The cat's name is <value expr="name"/>.
          He is <value expr="age"/> years old.
          His fur color is <value expr="color"/>.
        </prompt>
        <else/>
        <prompt>
          I did not understand you.
        </prompt>
      </if>
    </filled>
  </form>
</vxml>

The output of the above script would be:

Computer: Say either dog or cat.
Human: Dog.
Computer: The dog's name is Lassie.
Computer: He is 5 years old.
Computer: His fur color is brown.



Child Tags

<item>



Parent Tags

<item>, <rule>