是的,活动语法必须包含返回值“帮助”的“帮助”话语。help
然后,您使用标签捕获事件:
<?xml version="1.0" encoding="UTF-8"?>
<vxml xmlns="http://www.w3.org/2001/vxml" version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd">
<form id="test">
<field name="var1">
<prompt bargein="true" bargeintype="hotword" >say xy </prompt>
<grammar src = "grammar.grxml" type="application/srgs+xml" />
<filled>
<assign name="myProdukt" expr="var1" />
you said <value expr="myProdukt"/>
</filled>
<help>
To choose a product, say,
<!-- whatever the product choices are -->
frobinator, submarine, curling iron, ..
<reprompt/>
</help>
</field>
</form>
</vxml>
或者,遵循DRY 原则,可以使用 包含元素的应用程序根文档为您的应用程序全局完成此效果。在下面的示例文档中,将全局语法“帮助”话语绑定到事件:link
app-root.vxml
link
help
<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
<link event="help">
<grammar mode="voice" root="root_rule" tag-format="semantics/1.0"
type="application/srgs+xml" version="1.0" xml:lang="en-US">
<rule id="root_rule" scope="public">
<one-of>
<item weight="1.0">
help
</item>
</one-of>
</rule>
</grammar>
</link>
</vxml>
该语法将在任何地方都有效——有效地与每个有效字段语法合并。如果您需要有关应用程序根文档的更多信息,VoiceXML 规范执行多文档应用程序部分会解释。另请参阅Tellme Studio文档中的处理事件
然后,在应用程序的页面中,通过元素的application
属性引用应用程序根文档,并在catch 块中适当地说:vxml
help
<?xml version="1.0" encoding="UTF-8"?>
<vxml xmlns="http://www.w3.org/2001/vxml" version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd"
application="app-root.vxml">
<form id="test">
<field name="var1">
<prompt bargein="true" bargeintype="hotword" >say xy </prompt>
<grammar src = "grammar.grxml" type="application/srgs+xml" />
<filled>
<assign name="myProdukt" expr="var1" />
you said <value expr="myProdukt"/>
</filled>
<help>
To choose a product, say,
<!-- whatever the product choices are -->
frobinator, submarine, curling iron, ..
<reprompt/>
</help>
</field>
</form>
</vxml>
当然,您可以将link
代码与表单放在同一页面中,但您可能希望help
应用程序的每个字段都处于活动状态,除非与特定字段的语法中的某些内容发生冲突。