<one-of>

New in VoiceXML 2.0. XML grammar input element that indicates alternative user inputs.

Syntax

 <one-of
     xml:lang="lang"
 >
   Alternatives
 </one-of>

Description

This tag is used to define grammars in the XML form of the W3C Speech Recognition Grammar Format.

The contained items are alternatives; any one of them may be matched by the user input. Each alternative is an <item> element.

Attribute Description
xml:lang

The language and optional country local identifier for the set of alternatives. Optional (default is the language of the enclosing element).

The accepted language identifiers are:

 •  en--English
 •  en-US--United States English
 •  es--Spanish
 •  es-US--United States Spanish
 •  fr-ca--French Canadian

This attribute allows you to mix multiple languages in the same rule. If an unsupported language is specified, an error.unsupported.language event is thrown.

Usage

Parents Children
<rule>
<item>
<item>

See Also

 •  Speech Recognition Grammar Specification: <one-of>
 •  Chapter  4, XML Speech Grammar Format in the Grammar Reference

Examples

 <grammar ...>
   <rule id="coloredObject">
     <ruleref id="color"/>
     <ruleref id="object"/>
   </rule>
 
   <rule id="color">
     <one-of>
       <item> red    <tag> color="red"    </tag> </item>
       <item> pink   <tag> color="red"    </tag> </item>
       <item> yellow <tag> color="yellow" </tag> </item>
       <item> canary <tag> color="yellow" </tag> </item>
       <item> green  <tag> color="green"  </tag> </item>
       <item> khaki  <tag> color="green"  </tag> </item>
     </one-of>
   </rule>
 
   <rule id="object">
     <one-of>
       <item> 
         <tag> object="vehicle" </tag>
         <one-of><item>truck</item><item>car</item></one-of>
       </item>
       <item> 
         <tag> object="toy" </tag>
         <one-of><item>ball</item><item>block</item></one-of>
       </item>
       <item> 
         <tag> object="clothing" </tag>
         <one-of><item>shirt</item><item>blouse</item></one-of>
       </item>
     </one-of>
   </rule>
  </grammar>

[Show Frames]   [FIRST] [PREVIOUS] [NEXT]
BeVocal, Inc. 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