VoiceXML 2.1 Development GuideHome  |  Frameset Home


<ruleref>  element

The ruleref element is an SRGS addition to VXML 2.0 that allows the developer to specify an existing rule for inclusion within the current grammar.


usage
<ruleref special="(NULL|VOID|GARBAGE)" uri="CDATA">


attributes
specialData Type: (NULL|VOID|GARBAGE)Default: Optional
The special attribute denotes rulenames which are disallowed for redefinition within a grammar. Allowable values are:

  • $NULL -- A rule which is automatically matched
  • $VOID --  A rule that can never be spoken
  • $GARBAGE -- A rule that may match any speech up until the next rule match

Note that either special or uri may be defined for the Ruleref element, but not both.
uriData Type: CDATADefault: Optional
The uri attribute specifies the URI of the external grammar that is to be referenced. Note that existing rules within the same file can be referenced:

<ruleref uri="#MYRULE"/>

or rules from an external file may be referenced:

<ruleref uri="MyGrammar.xml#MYRULE"



shadow variables
none


parents
<item> <rule>


children
none


code samples
<RuleRef URI> sample
<?xml version="1.0" encoding="UTF-8" ?>


<vxml version = "2.1">

<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>

<form id="F1">

  <field name="F_1">
    <prompt>
      William Burroughs. Is he just an understated genius,
or simply a half baked junkie writer?
    </prompt>

    <grammar src="MyGram.xml" type="application/grammar-xml"/>

    <filled>
      <prompt>
        Say, that guess is as good as any, I suppose.
    </prompt>

  </filled>

  </field>

</form>

</vxml>

>MyGram.xml>
<?xml version= "1.0"?>


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

  <rule id="MYRULE">
      <one-of>
        <item>

        <!-- note that a fully qualified URL is required -->
<ruleref uri=
            "http://MyServer.com/MyDirectory/MyAlias.xml#MYRULE3"/>

        </item>
        <item> alien <tag> <![CDATA[  <F_1 "alien"> ]]>  </tag> </item>
      </one-of>
    </rule>

</grammar>

Motorola <MyAlias.xml>
<?xml version= "1.0"?>

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

<!-- note that we MUST declare the rule scope as 'public' -->         
  <rule id="MYRULE3" scope="public">
    <one-of>
      <item> genius <tag> <![CDATA[  <F_1 "genius"> ]]>  </tag> </item>
      <item> smart <tag> <![CDATA[  <F_1 "smart"> ]]>  </tag> </item>
      <item> dumb <tag> <![CDATA[  <F_1 "dumb"> ]]>  </tag> </item>     
    </one-of>
  </rule>
</grammar>



additional links
W3C SRGS 1.0 Specification


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

login



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