# \<rule>

## \<rule> <a href="#rule" id="rule"></a>

An SRGS+XML rule definition is contained within a `<rule>` block.

### Attributes

<table><thead><tr><th width="123.33333333333331">Name</th><th width="158">Data type<select><option value="76e9e6a0ccc240f28756d5de0fcfbc42" label="String" color="blue"></option><option value="c4f21faa49804e8f825b390ac7911577" label="Integer" color="blue"></option><option value="63593605c5a142359b085b2e73df21c6" label="Boolean" color="blue"></option></select></th><th>Description</th></tr></thead><tbody><tr><td>id</td><td><span data-option="76e9e6a0ccc240f28756d5de0fcfbc42">String</span></td><td>This attribute specifies the rulename for the rule.</td></tr><tr><td>scope</td><td><span data-option="76e9e6a0ccc240f28756d5de0fcfbc42">String</span></td><td>Can be either “public” or “private”.</td></tr></tbody></table>

### Notes

For examples and usage information, please refer to the [Speech Recognition Grammar Specification](http://www.w3.org/TR/2002/CR-speech-grammar-20020626/).

### Example

```markup
<?xml version="1.0"?>
<vxml version="2.0">
  <form>
    <field name="animal">
      <grammar type="application/srgs+xml" root="ROOT" mode="voice">
        <rule id="ROOT">
          <one-of>
            <item>Dog</item>
            <item>Cat</item>
          </one-of>
        </rule>
      </grammar>
      <prompt>
        Say either dog or cat.
      </prompt>
      <filled>
        <prompt>
          You said <value expr="animal"/>. Goodbye.
        </prompt>
        <exit/>
      </filled>
    </field>
  </form>
</vxml>
```

The output of the above script would be:

> Computer: Say either dog or cat.\
> Human: Dog.\
> Computer: You said dog.

### Child Tags

[\<example>](/dev/voicexml/tags/example-tag.md), [\<item>](/dev/voicexml/tags/item-tag.md), [\<one-of>](/dev/voicexml/tags/one-of-tag.md), [\<ruleref>](/dev/voicexml/tags/ruleref-tag.md), [\<tag>](/dev/voicexml/tags/tag-tag.md), [\<token>](/dev/voicexml/tags/token-tag.md)

### Parent Tags

[\<grammar>](/dev/voicexml/tags/grammar-tag.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.plumvoice.com/dev/voicexml/tags/rule-tag.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
