one-of Element

Specifies a set of alternative phrases that can possibly be matched by a user's speech input. Each alternative word or phrase must be enclosed within an item element.






Unlike the Speech Recognition Grammar Specification (SRGS) Version 1.0 specification, System.Speech does not support the use of the xml:lang attribute on the one-of element. Grammars in System.Speech can contain only one language, and this must be declared in the grammar Element.


The rule named phoneRule in the grammar shown below recognizes utterances such as the following:

  • Call him at home.

  • Call her office.

  • Phone her at office.

The repeat attribute on the item element indicates that the words in the one-of element it encloses can be spoken zero or one time, making them optional.

<grammar root="phoneRule" version="1.0" xmlns=""
 xml:lang="en-US" tag-format="semantics/1.0">

  <rule id="phoneRule" scope="public">

      <item> call </item> 
      <item> phone </item> 

      <item> him </item> 
      <item> her </item>  
    <item repeat="0-1">
        <item> on </item>
        <item> at </item>

      <item> home </item>
      <item> mobile </item>