Home > Articles > Web Services > XML

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

3.3 block

Element type

block

Attributes

cond | expr | name

Parents

form

Children

assign | audio | clear | disconnect | enumerate | exit | goto | if | log | prompt | reprompt | return | script | submit | throw | value | var

Description

A block is a form item that contains (non-interactive) executable code consisting of a sequence of procedural statements used for prompting and computation, not for gathering input. A block has a (normally implicit) form item variable that is set to true just before it is interpreted.

DTD

<!ELEMENT block (%executable.content;)* >
<!ATTLIST block
  %item.attrs; >

Language model


03mod11.gif


Attributes

cond : expression = true

A guard condition associated with this form item, written as an ECMAScript expression. This expression must evaluate to true for the Form Interpretation Algorithm to visit this form item.

expr : expression = undefined

An ECMAScript expression defining an initial value for this form item. The Form Interpretation Algorithm will not visit the form item if its value is initially set to an ECMAScript expression other than undefined.

name : field.name

The name associated with this form item. When the caller fills this form-item, by producing an utterance that matches that item's grammar, the value will be stored in a variable of this name visible from within the containing <form> element.

Children

executable.content

To be run when this block is visited by the Form Interpretation Algorithm.

Examples

Example 3-3 A form simply playing audio in a block

<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="1.0"> 
  <property name="caching" value="fast"/> 
  <form id="test"> 
    <block> 
      <audio src="http://www.example.com/vxml/welcome.wav"/> 
      <audio caching="safe" 
             src="http://www.example.com/weather4U/ad17"/> 
    </block>
  </form>
</vxml>

Example 3-4 A block using text-to-speech to render several variables

<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="1.0"> 
  <property name="caching" value="fast"/> 
  <form id="test"> 
    <block> 
      <prompt> 
        The card type is <value expr="debit.card"/>. 
      </prompt> 
      <prompt> 
        The card number is <value expr="debit.card_no"/>. 
      </prompt> 
      <prompt> 
        The expiration date is <value expr="debit.expiry_date"/>.
      </prompt> 
      <prompt> 
        The approval code is <value expr="debit.approval_code"/>.
      </prompt> 
      <prompt>
        The confirmation number is <value expr="debit.conf_no"/>.
      </prompt> 
    </block>
  </form>
</vxml>

Example 3-5 Passing control from a block with a goto

<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="1.0"> 
  <meta name="author" content="John Doe"/> 
  <meta name="maintainer" content="hello-support@hi.example"/> 
  <var name="hi" expr="'Hello World!'"/> 
  <form> 
    <block> 
      <value expr="hi"/> 
      <goto next="#say_goodbye"/> 
    </block> 
  </form> 
  <form id="say_goodbye"> 
    <block> Goodbye! </block> 
  </form> 
</vxml>
  • + Share This
  • 🔖 Save To Your Account