The following table shows the header declarations supported by
the grammar slot type. For more information, see Grammar
header declarations
Declaration | Specification requirement | XML form | Amazon Lex support | Specification |
---|---|---|---|---|
Grammar version | Required | 4.3version attribute
on grammar element |
Required | SRGS |
XML namespace | Required (XML only) | 4.3xmlns attribute
on grammar element |
Required | SRGS |
Document type | Required (XML only) | 4.3 |
Recommended | SRGS |
Character encoding | Recommended | 4.4encoding
attribute in XML declaration |
Recommended | SRGS |
Language | Required in voice mode Ignored in DTMF mode |
4.5xml:lang
attribute on grammar
element |
Required in voice mode Ignored in DTMF mode |
SRGS |
Mode | Optional | 4.6mode attribute on
grammar element |
Optional | SRGS |
Root rule | Optional | 4.7root attribute on
grammar element |
Required | SRGS |
Tag format | Optional | 4.8tag-format
attribute on grammar
element |
String literal and ECMAScript are supported | SRGS, SISR |
Base URI | Optional | 4.9xml:base
attribute on grammar
element |
Optional | SRGS |
Pronunciation lexicon | Optional, multiple allowed | 4.10lexicon
element |
Not supported | SRGS, PLS |
Metadata | Optional, multiple allowed | 4.11.1meta
element |
Required | SRGS |
XML metadata | Optional, XML only | 4.11.2metadata
element |
Optional | SRGS |
Tag | Optional, multiple allowed | 4.12tag
element |
Global tags not supported | SRGS |
Example
<?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"
xml:base="http://www.example.com/base-file-path"
xsi:schemaLocation="http://www.w3.org/2001/06/grammar
http://www.w3.org/TR/speech-grammar/grammar.xsd"
xml:lang="en-US"
version="1.0"
mode="voice"
root="city"
tag-format="semantics/1.0">