Last reviewed: 3/23/2024 8:50:26 AM
In this article
<rule>
A <rule> element can surround any expansion (<rule>, <one-of>, <ruleref>, <tag>, <token>) to permit a repeat attribute or language identifier to be attached. The weight attribute of rule is ignored unless the element appears within a <one-of> element.
Syntax
<rule id="string" scope="scopetype" />
Attributes
id
A unique identifier.
scope
Defines whether it is local (private) to the grammar in which it is defined or whether it may be referenced within other grammars (public).
Children
<example>, <one-of>, <ruleref>, <tag>, and <token>.
Parents
Example
The following example illustrates using rule elements.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN" "http://www.w3.org/TR/speech-grammar/grammar.dtd">
<grammar xmlns="http://www.w3.org/2001/06/grammar"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
xml:lang="En" version="1.0" mode="voice" >
<rule id="city">
<one-of>
<item>Atlanta</item>
<item>Miami</item>
<item>New York</item>
</one-of>
</rule>
</grammar>