<value>
Dynamically generates a prompt from a variable. The <value> element can also be used to format variable output. See <log> element for details.
In Voice Platform, the <value> element implicitly wraps a <say-as> element around itself when playing back built-in grammar results, for example:
<field type="boolean" name="yesno">
<prompt> say yes or no </prompt>
<filled>
<prompt> You said <value expr="yesno"/> </prompt>
</filled>
</field>
As a result, you no longer need to explicitly specify <say-as> as a parent element of <value>. Specifying <say-as> as a parent element of <value> will only result in a double wrapping of the <say-as> element.
Implicit wrapping of the <say-as> element occurs when the following field types are recognized by the <value> element:
- standard field types, for example, <field type="boolean" name="yesno">
- parameterized field types, for example, <field type="dtmf/boolean?y=7" name="yesno">
- Nuance extension field types, for example, <field type="x-nuance-strictboolean" name="yesno">
Note: The implicit wrapping of the <say-as> element only applies to fields that use the type attribute for specifying built-in grammars. As a result, fields using builtin: URLs for grammars such as <grammar src="builtin:boolean"/> still require the <value> element to be explicitly wrapped within the <say-as> element.
If the variable is not a field variable, you can use the SSML <say-as> element to specify how a value is to be spoken—for example, to speak a number (“20090222”) as a date. For more information, see .
Attributes
This section describes the attributes you can set for this element.
Name |
Data type |
Default |
---|---|---|
CDATA |
required |
|
boolean |
false |
expr
The expr attribute specifies the text to be rendered.
treatasmarkup
The treatasmarkup attribute indicates that the enclosed value is to be interpreted as marked-up text. For example:
<var name="literalSSML" expr="'<emphasis> Hello World </emphasis>'>
<prompt>
Playing text marked up with SSML elements:
<value treatasmarkup="true" expr="literalSSML"/>
</prompt>
The text is interpreted correctly as being enclosed by the <emphasis> element.
Children
None.
Parents
- <audio>
- <block>
- <catch>
- <choice>
- <enumerate>
- <error>
- <field>
- <filled>
- <foreach>
- <grammar>
- <help>
- <if>
- <initial>
- <log>
- <menu>
- <noinput>
- <nomatch>
- <option>
- <prompt>
- <record>
- <subdialog>
- <transfer>
Sample code
<field type="digits" name="ssn">
<prompt> What is your social security number? </prompt>
<filled>
<prompt> I heard <value expr="ssn"/>. Is that correct?</prompt>
</filled>
</field>