Inserts the value of a expression into audio output.
<value
expr="js_expression"
/>
| Attribute | Description |
expr |
JavaScript expression to evaluate and insert in the prompt. Note: In VoiceXML 2.0, the recorded audio stored in the input variable of a |
(VoiceXML 1.0 only) The following attributes can be used in applications in which the version attribute of the <vxml> tag is set to 1.0.
| Attribute | Description |
class type |
VoiceXML 1.0 only. The The Note: A VoiceXML 2.0 application should not use either of these attributes, but should instead enclose the |
The following event may be thrown during the execution of a <say-as> element:
error.badfetch--Thrown in VoiceXML 2.0 when any of the following attributes are present: class, mode or recsrc. These attributes are not valid for version 2.0.
|
|||
|
| | VoiceXML 2.0 Specification: <value> |
| | Related tags: <assign>, <var>, <field>, <record>, <subdialog>, <transfer>, <block>, <initial> |
| | <say-as> |
Example 1--with input variable:
<?xml version="1.0" ?>
<!DOCTYPE vxml PUBLIC "-//BeVocal Inc//VoiceXML 2.0//EN"
"http://cafe.bevocal.com/libraries/dtd/vxml2-0-bevocal.dtd">
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
<form>
<field name="state">
<prompt>
Do you want texas or california?
</prompt>
<grammar type="application/x-nuance-gsl">
[ texas california ]
</grammar>
</field>
<block>
<prompt>
Your answer was
<value expr="state"/>
</prompt>
</block>
</form>
</vxml>
<?xml version="1.0" ?>
<!DOCTYPE vxml PUBLIC "-//BeVocal Inc//VoiceXML 2.0//EN"
"http://cafe.bevocal.com/libraries/dtd/vxml2-0-bevocal.dtd">
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
<property name="universals" value="help" />
<form id="myCalculator">
<var name="result"/>
<field name="op"> <!-- OPERATION -->
<prompt>
BeVocal calculator.
Choose add, subtract, multiply, or divide.
</prompt>
<grammar type="application/x-nuance-gsl">
[add subtract multiply divide]
</grammar>
<help>Say add, subtract, multiply, or divide.</help>
<filled>
<prompt>Okay, let's <value expr="op"/> two numbers.</prompt>
</filled>
</field>
<field name="a" type="number"> <!-- FIRST OPERAND -->
<prompt>Whats the first number?</prompt>
<help>
Please say a number. This number will be used as the first operand.
</help>
<filled>
<prompt><value expr="a"/></prompt>
</filled>
</field>
<field name="b" type="number"> <!-- SECOND OPERAND -->
<prompt>and the second number?</prompt>
<help>
Please say a number. This number will be used as the second operand.
</help>
<filled>
<prompt><value expr="b"/> Okay.</prompt>
<!-- NOW SAY THE RESULT -->
<if cond="op=='add'">
<!-- NOTE: Use Number() here in order to avoid
interpreting + as string concatenation! -->
<assign name="result" expr="Number(a) + Number(b)"/>
<prompt>
<value expr="a"/> plus <value expr="b"/> equals
<value expr="result"/>
</prompt>
<elseif cond="op=='subtract'"/>
<assign name="result" expr="a - b"/>
<prompt>
<value expr="a"/> minus <value expr="b"/> equals
<value expr="result"/>
</prompt>
<elseif cond="op=='multiply'"/>
<assign name="result" expr="a * b"/>
<prompt>
<value expr="a"/> times <value expr="b"/> equals
<value expr="result"/>
</prompt>
<elseif cond="op=='divide'"/>
<assign name="result" expr="a / b"/>
<prompt>
<value expr="a"/> divided by <value expr="b"/> equals
<value expr="result"/>
</prompt>
</if>
<clear/>
</filled>
</field>
</form>
</vxml>
| Café Home |
Developer Agreement |
Privacy Policy |
Site Map |
Terms & Conditions Part No. 520-0001-02 | © 1999-2007, BeVocal, Inc. All rights reserved | 1.877.33.VOCAL |