VoiceXML 2.1 Development GuideHome  |  Frameset Home

  grXML Grammar Slots  |  TOC  |  grXML Subgrammars  

XML Multislot Grammars

Defining a slot with multiple slots can easily be achieved by using the same methodology as we use for GSL grammars. However, the semantics for doing this in the XML format are obviously quite different. To ease the ever-popular Learning Curve, we will simply port the previously discussed GSL multislot grammar into the XML format.

MLBTeams.grxml



<?xml version= "1.0"?>

<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-US" root = "STANDINGS">

  <rule id="STANDINGS" scope="public">
    <one-of lang-list="en-US">

      <item> boston red sox
          <tag> <![CDATA[  <team "boston"> <league "american"> <division "east"> <standing "first">  ]]>  </tag>
      </item>

    <item>new york yankees
          <tag> <![CDATA[  <team "New York"> <league "American"> <division "east"> <standing "last">  ]]>  </tag>
      </item>

      <item>toronto blue jays
          <tag> <![CDATA[  <team "Toronto"> <league "American"> <division "east"> <standing "second">  ]]>  </tag>
    </item>

  </one-of>
    </rule>

</grammar>


UtteranceSlot= 'team'Slot= 'league'Slot= 'division'Slot= 'standing'
(red sox) {<team "Boston"><league "American"> <division "east">} <standing "first">}


And what about the invoking code, you ask? Look no further:

MultiSlot.vxml



<?xml version="1.0" encoding="UTF-8" ?>
<vxml version="2.0">

<form id="multipleslots">

  <field name="F_1"> 
    <grammar src="MLBTeams.grxml" type="application/grammar-xml"/>

    <prompt>Please select a baseball team.</prompt>

    <filled> 
      <prompt>

        You selected <value expr="lastresult$.interpretation.team"/>.
        They are in <value expr="lastresult$.interpretation.standing"/> place
        in the <value expr="lastresult$.interpretation.league"/> league
        <value expr="lastresult$.interpretation.division"/>.

      </prompt>
    </filled>
  </field>

</form>
</vxml>


Download the Code!

  Download the source code



  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login
  grXML Grammar Slots  |  TOC  |  grXML Subgrammars  

© 2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site