This chapter is from the book
3.58 var
Element type |
var |
Attributes |
expr | name |
Parents |
block | catch | error | filled | form | help | if | noinput | nomatch | vxml |
Children |
None. |
Description |
Declares a variable in the scope of its parent element. |
DTD
<!ELEMENT var EMPTY > <!ATTLIST var name %field.name; #REQUIRED expr %expression; #IMPLIED >
Language model
Attributes
-
name : field.name
Name of the variable to declare.
-
expr : expression
An ECMAScript expression of the value.
Children
None.
Examples
Example 3-69 Defining a variable with var
<?xml version="1.0" encoding="iso-8859-1"?> <vxml version="1.0"> <var name="greeting" expr="'good day'"/> <form> <field name="language"> <grammar>english | french | german</grammar> <prompt>What language?</prompt> <noinput> Choose between English, French, and German. </noinput> <filled> <if cond="language=='french'"> <assign name="greeting" expr="'bon jour'"/> <elseif cond="language=='german'"/> <assign name="greeting" expr="'guten tag'"/> </if> <if cond="language=='english'"> <prompt> <value expr="greeting"/>! </prompt> <else/> <prompt> And in <value expr="language"/>, <value expr="greeting"/>! </prompt> </if> </filled> </field> </form> </vxml>