Home > Articles > Web Services > XML

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

3.53 tag

Element type

tag

Attributes

tag-format

Parents

item | rule | ruleref

Children

CDATA

Description

This element is used to associate meaning with a rule-expansion inside a grammar. It does not affect what utterances are matched by a given rule-expansion, but associates names or ECMAScript actions so the VoiceXML application can access the results of a recognition. The element will probably change as the Semantic Interpretation for Speech Recognition Specification matures. Note that this element replaces the tag attribute defined in the earlier version of VoiceXML 2.0.

DTD

<!ELEMENT tag (CDATA) >
<!ATTLIST tag
  tag-format CDATA >

Language model

53

Attributes

  • tag-format : CDATA

    Indicates the format of the tag contents.

Children

  • CDATA

    The tag contents to be evaluated as the meaning of a rule expansion. This is often a symbol that represents a user response or an ECMAScript expression to be executed if a particular rule expansion is matched.

Examples

Example 3-64 Using the tag element to fill a variable from a grammar

<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="2.0">
  <form id="test">
    <field name="favcolor">
      <prompt>What is your favorite color?</prompt>
      <grammar xml:lang="en-US" version="1.0" root="colors">
        <rule id="colors" scope="public">
          <one-of>
            <item><tag>red</tag>red</item>
            <item weight="0.5"><tag>red</tag>burgundy</item>
            <item><tag>blue</tag>blue</item>
            <item weight="0.5"><tag>blue</tag>indigo</item>
            <item><tag>green</tag>green</item>
          </one-of>
        </rule>
      </grammar>
      <filled>
        <prompt>You said <value expr="favcolor"/>.</prompt>
      </filled>
    </field>
  </form>
</vxml>
  • + Share This
  • 🔖 Save To Your Account