VoiceXML 2.1 Development GuideHome  |  Frameset Home

  Universal Grammars  |  TOC  |  DTMF Grammars in the GSL Format  

Grammar Slots

The grammar slotnames, if not explicitly defined in the originating <field>, will default to the fieldname itself. The use of grammar slots comes in handy when we want to reuse a grammar in more than one <field>,  as evidenced in the example below:

GrammarSlot.vxml

<?xml version="1.0"?>

<vxml version="2.0">
  <form>

    <field name="F_1" slot="MySlot">
      <grammar src="GrammarFile.gsl#MYRULE" type="text/gsl"/>
      <prompt>
        what is your favorite cheese?
      </prompt>

        <filled>
        <prompt> 
          You said <value expr="F_1$.interpretation.MySlot"/>
        </prompt>
          <goto nextitem="F_2"/>
        </filled>

    </field>

    <field name="F_2" slot="MySlot">
      <grammar src="GrammarFile.gsl#MYRULE" type="text/gsl"/>
      <prompt>
        what is your least favorite cheese?
      </prompt>

      <filled>
      <prompt> 
        You said <value expr="F_2$.interpretation.MySlot"/>
      </prompt>
      </filled>

    </field>
  </form>
</vxml>



GrammarFile.gsl

MYRULE    [
[cheddar]                            {<MySlot "cheddar">}
(?monteray jack)                    {<MySlot "jack">}
(+stinky french cheese)            {<MySlot "stinky">}
                ]




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

login
  Universal Grammars  |  TOC  |  DTMF Grammars in the GSL Format  

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