January 27, 2021
Hot Topics:

Excerpt: Early Adopter VoiceXML: VoiceXML with XSLT (HTML and WML), Part 3

  • By Developer.com Staff
  • Send Email »
  • More Articles »

At this point we'll skip over the product list option, because it doesn't illustrate anything we haven't already seen. However, the product listing prompt offers the user the option to say, "Buy me", in which case their call is transferred to the MyRubberbands.com's telephone service center by the placeOrder form below. This is the quickest way for the company to add some commerce capability to the voice system, but note that the VoiceXML <transfer> element is not implemented by all platforms. When the user returns from the call, they are unconditionally sent to the main menu by the subsequent <goto> element.

<form id="placeOrder">   
<prompt bargein="false" timeout="1s">
Transferring your call to customer service.
<transfer name="callSales" dest="MYRUBBERBND" 
connecttimeout="30s" bridge="true"/>   
<goto next="#mainMenu"/>   
We can also skip over the frequently asked questions option, since it contains only static VoiceXML code. We are now almost at the end of our stylesheet, where the navigator form is located, holding the navigation logic for many of the state transitions in our interface design.

It consists simply of an if-else construct that expresses the state transitions on the diagram of the user interface earlier. If more commands, states, or transitions were to be added to the design, the complexity of the interface might exceed the limitations of this method of implementation.

<form id="navigator">   
<if cond="user_command == 'product list' || 
user_command == 'list'">       
<goto next="#productList"/>     
<elseif cond="user_command  == 'questions' ||           
user_command == 'frequently asked questions' ||           
user_command == 'more information'"/>       
<goto next="#FAQ"/>     
<elseif cond="user_command == 'order status'"/>       
<goto next="#orderStatus"/>     
<elseif cond="user_command == 'buy me'"/>       
<goto next="#placeOrder"/>
The stylesheet drives the rest of the navigation engine by creating forms for each individual order in this customer's order history. It does this by means of the following <xsl:for-each> construct:
<xsl:for-each select="order_history/order"> 
<xsl:variable name="order_counter" select="position()"/>     
<elseif cond="user_command == 
'order number {$order_counter}'"/>       
<goto next="#order_{$order_counter}"/> 
<goto next="#mainMenu"/>     

Page 3 of 5

This article was originally published on March 14, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date