rule element
VoiceXML 2.0
Defines a grammar rule.

Syntax

<rule
id = "string"
scope = "string"
/>

Attributes
id
Required. A name that uniquely identifies the rule within the grammar.
scope
One of the following values:
private Indicates that the rule has local scope.
public Indicates that the rule can be referenced from other grammars.

Parents
None.

Children
example, item, one-of, ruleref

Examples

The following example defines a rule that demonstrates a simple yes-no-cancel grammar.

<grammar xml:lang="en-US"
         type="application/srgs+xml" 
         tag-format="semantics/1.0"
         root="yes_no_cancel"
         version="1.0" 
         mode="voice">
   <rule id="yes_no_cancel" scope="public"> 
      <one-of>
         <item>
           no
           <tag> out = "no"; </tag>
         </item>
         <item>
           <one-of>
             <item>yes</item> 
             <item>okay</item>
           </one-of>
           <tag> out = "yes"; </tag>
         </item>
         <item>
            cancel
            <tag> out = "cancel"; </tag>
         </item>
      </one-of>
   </rule>
</grammar>


[24]7 Inc.| Terms of Service| Privacy Policy| General Disclaimers