Declares a variable in the scope of its parent element. If the <var> occurs in executable content, the declaration is made only when the <var> element is executed. If the <var> occurs as a child of a <form>, the declaration is made during the form's initialization phase. If the <var> occurs as a child of <vxml>, the declaration is made when the document is initialized (in document order). If the variable is already defined in the current scope, further declarations are treated as value assignments.
<var name="string" expr="ECMAScript_Expression"/>
|
Attribute |
Description |
|
name |
The name of the variable. Required. |
|
expr |
An ECMAScript expression to be evaluated and used as the initial value assigned to the variable. Optional. (Defaults to undefined.) |
Block Catch Error Filled ForEach Form Help If Noinput Nomatch Vxml
None
None
<var> cannot be used as a child of <foreach> when <foreach> is a child of <prompt> and vxmli.conformance.disallow_exec_content_within_prompts is set to true.
<?xml version="1.0"?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"> <var name="var1" expr="'first'"/> <form> <block> The initial value is <value expr="var1"/>. </block> </form> </vxml>