3.47. ruleref

Element typeruleref
Attributesspecial | tag | uri | xml:lang
Parentsitem | rule
Childrentag
DescriptionAllows a rule expansion to refer to an existing rule element as part of its definition. This element allows for the development of reusable rules.

DTD

<!ELEMENT ruleref (tag) >
<!ATTLIST ruleref
  uri      CDATA   #IMPLIED
  special  CDATA   #IMPLIED
  xml:lang NMTOKEN #IMPLIED
  tag      CDATA   #IMPLIED >

Language model



Attributes

special : CDATA

Indicates that this rule reference points to a “built-in,” rule. The special rules currently supported are #NULL, #VOID, and #GARBAGE.

tag : CDATA

Specifies the action to be taken if this rule reference participates in the matching of its containing rule element. This action is typically written as an ECMAScript expression.

uri : CDATA

The URI of the rule being referred to. It must point to an existing rule either within the same document or in another document. The former would be represented with a URI of the form #ruleid where ruleid is equal to the desired rule element's id attribute value. The latter would be represented with a URI of the form uri#ruleid where uri points to a document containing the desired rule and ruleid is as described above.

xml:lang : NMTOKEN

Specifies the spoken language used with this element - for example, en-US for US English.

Children

None.

Examples

The rulerefs in Example 3-58 call the city rule which is defined elsewhere. If this item element is matched, the ECMAScript interpreter will execute each of the ruleref elements' tag attributes.

Example 3-58. A ruleref element referring to the city rule
<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="2.0">
  <form>
    <grammar root="flightrule">
      <rule id="flightrule" scope="public">
        <count number="optional">
          <item>I'd like to fly</item>
        </count>
        to <ruleref uri="flightGrammars.grxml#city"> 
             <tag>arrive=city.returnvalue;</tag></ruleref>  
        from <ruleref uri="flightGrammars.grxml#city"> 
               <tag>depart=city.returnvalue;</tag></ruleref>
      </rule>
    </grammar>
    <initial>Say where you are flying to and from.</initial>
    <field name="arrive"/>
    <field name="depart"/>
    <filled>
      <prompt>
        Got it. You're flying from <value expr="depart"/>
        to <value expr="arrive"/>.
      </prompt>
    </filled>
  </form>
</vxml>

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.77.131