Motorola 1 manual Switch Element

Page 49

VoxML 1.0 Element Reference

SWITCH Element

SWITCH Element

The SWITCH element is used to define the application behavior dependant on the value of a specified recognition slot. The SWITCH element is used only in conjunction with the CASE element.

The SWITCH element can exist only within the INPUT element, and then only when using the GRAMMAR input type.

Syntax

<SWITCH FIELD="value"> VoxML </SWITCH>

Attributes

Attribute Name

Allowed Values

FIELDidentifier

Examples

1<INPUT TYPE="GRAMMAR"

2SRC="gram://.Banking/action/amount/fromacct/toacct">

3<SWITCH FIELD="action">

4<CASE VALUE="transfer" NEXT="#transfer" />

5<CASE VALUE="balance" NEXT="#balance" />

6<CASE VALUE="activity">

7<SWITCH FIELD="fromacct">

8<CASE VALUE="checking" NEXT="#chxact" />

9<CASE VALUE="savings" NEXT="#savact" />

10</SWITCH>

11</CASE>

12</SWITCH>

13</INPUT>

This example shows how a SWITCH element might be used to determine the next step to execute in response to a banking request. In this example, the grammar may fill in some or all of the variables “action”, “amount”, “fromacct”, and “toacct”. If the user asks for a transfer or balance action, the next step to execute is the transfer or balance step. If the user asks for a report of account activity, a second SWITCH element determines the next step based on the account type for which a report is being requested (assumed to be available in the “fromacct” variable).

October 1998

VoxML 1.0 Language Reference 45

Image 49
Contents Revision VoxML Language ReferencePage Contents Appendices Overview What is VoxMLPurpose of this Document DIALOGs and STEPs Structure of a VoxML DocumentBasic Elements VoxML 1.0 Application Development Guide Other Reference DocumentationSyntax ACK ElementAttributes Examples Audio Element Break Element Next step URL Cancel ElementExamples Case Element Integer Class ElementExamples Dialog Element EMP Element Error Element Input TYPE=OPTIONLIST Help Element Option NEXT=#end done /OPTION 11 /INPUT 12 /STEP Input Element Data Format Input Element Type DateInput Element Type Digits Input Element Type Grammar Input Element Type Hidden Input Element Type Money Input Element Type None Input Element Type Number Input Element Type Optionlist Input Element Type Phone Input Element Type PROFILE‡ Input Element Type Record Prompt Input Element Type Time Input Element Type Yorn Option Element VoxML 1.0 Element Reference Options Element Syntax Attributes Or ElementPrompt Element Pros Element Rename Element Response Element Examples Step Element Switch Element Prompt Value ElementAppendix a VoxML 1.0 Document Type Definition AppendicesOctober VoxML 1.0 Language Reference Vcard Profile Names and Subtypes Appendix B Vcard Profile Names and SubtypesFirst