VoiceXML 2.1 Development GuideHome  |  Frameset Home

  External GSL Subgrammars  |  TOC  |  Downloadable GSL Subgrammar Library  

Inline GSL Subgrammars

Constructing an inline subgrammar follows the same rules as a flat file grammar: since we must define slot values, the grammar will need to be enclosed within a CDATA block. Additionally, whenever we have an inline multi-rule grammar be advised that we absolutely cannot reference the top level rulename in the 'src' attribute as is done on the Nuance VWS voice browsers:


<grammar src="#MYTOPLEVELRULE" type="text/gsl">
<!-- wont work with the Motorola browser -->
  <![CDATA[

            MYTOPLEVELRULE    [
          ......


Instead, we simply specify the grammar type, and prefix the top-level rulename with the required 'period' prefix:


InlineSub.vxml

<?xml version="1.0"?>

<vxml version="2.0">
 
  <form id="MainMenu">
    <field name="MyName">
      <prompt>
        Please say your first, middle, and last name.
      </prompt>

    <grammar type="application/x-gsl">
<![CDATA[
        .FULLNAME

        [NAME:d {<MyName $d>}]

        NAME
        (FIRSTNAME:a ?MIDDLENAME:b LASTNAME:c)
        {return(strcat($a strcat($b $c)))}

        FIRSTNAME
        [[matt] {return("matt ")}
          [mark] {return("mark ")}
          [mick] {return("mick ")}]

        MIDDLENAME
        [[warren]  {return("warren ")}
          [warner]  {return("warner ")}
          [warper]  {return(" ")}]

        LASTNAME
        [[henry]  {return("henry ")}
          [hesse]  {return("hesse ")}
          [hertz]  {return("hertz ")}]
]]>
</grammar>
      <filled>
        <prompt>
          You said <value expr="MyName"/>
        </prompt>
      </filled>
    </field>

  </form>
</vxml>




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

login
  External GSL Subgrammars  |  TOC  |  Downloadable GSL Subgrammar Library  

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