VoiceXML 2.1 Development Guide Home  |  Frameset Home

  External GSL Subgrammars  |  TOC  |  Downloadable GSL Subgrammar Library  

Inline GSL Subgrammars

Note: GSL syntax is not considered to be a W3C-compliant syntax for grammars, and the Nuance has discontinued support for GSL grammars in their most recent product offerings. Voxeo will continue to support GSL-specific markup for some time to come, but it is strongly suggested that new applications and their associated grammars leverage the SRGS + SISR grammar syntaxes instead of being reliant upon the deprecated GSL grammar format.

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 referencing the top level rulename in the 'src' attribute is entirely optional, as is preceding the rulename in the grammar file itself with a period (".").


<grammar src="#MYTOPLEVELRULE" type="text/gsl">
<!-- entirely optional when using the Prophecy browser -->
  <![CDATA[

            .MYTOPLEVELRULE    [
          ; entirely optional when using the Prophecy browser
          ......


The easiest way is to simply specify the grammar type and then include our grammar contents within the CDATA block as illustrated below:

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  

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