Voice XML Block expression
In this VXML
code either block's expr is true
or false
interpreter
doesnt read the block and only prints out block3 which doesnt have an
expression so what is the difference for a block to have an expression
value true开发者_StackOverflow社区
or false
?
<?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 id="foo">
<block expr="true">
<prompt>
block1
</prompt>
</block>
<block expr="false">
<prompt>
block2
</prompt>
</block>
<block>
<prompt>
block3
</prompt>
</block>
</form>
</vxml>
According to the VXML 2.0 spec, the expr attribute on a tag has the following function:
"The initial value of the form item variable; default is ECMAScript undefined. If initialized to a value, then the form item will not be visited unless the form item variable is cleared.
Because you have initialized a value for the first two blocks, they are not visited. (The Form Interpretation Algorithm specifies that the first item with an unset value will be visited.) You might be confusing expr with the cond attribute, which can be used to add a condition to an item to additionally control whether the item is visited. See section 2.1.3 of the spec for more details on the expr and cond attributes.
精彩评论