Rule reference
The following table summarizes the various forms of rule
reference that are possible within grammar documents. For more
information, see Rule
reference
Reference type | XML form | Supported |
---|---|---|
2.2.1 |
<ruleref
uri="#rulename"/> |
Yes |
2.2.2 |
<ruleref
uri="grammarURI#rulename"/> |
No |
2.2.2 |
<ruleref
uri="grammarURI"/> |
No |
2.2.2 |
<ruleref uri="grammarURI#rulename"
type="media-type"/> |
No |
2.2.2 |
<ruleref uri="grammarURI"
type="media-type"/> |
No |
2.2.3 |
|
No |
Notes
-
Grammar URI is an external URI. For example,
http://grammar.example.com/world-cities.grxml
. -
Media type can be:
-
application/srgs+xml
-
text/plain
-
Example
<rule id="city" scope="public">
<one-of>
<item>Boston</item>
<item>Philadelphia</item>
<item>Fargo</item>
</one-of>
</rule>
<rule id="state" scope="public">
<one-of>
<item>FL</item>
<item>MA</item>
<item>NY</item>
</one-of>
</rule>
<!-- "Boston MA" -> city = Boston, state = MA -->
<rule id="city_state" scope="public">
<ruleref uri="#city"/> <ruleref uri="#state"/>
</rule>