March 3, 2021
Hot Topics:

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

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

The following code generates the prompt to announce the order detail:

<prompt bargein="true" timeout="1s">       
This order was placed on <sayas class="date">       
<xsl:value-of select=
<break msecs="500"/>       
The order consisted of 
<xsl:for-each select="product">       
<xsl:value-of select="./@quantity"/> 
of product
The <xsl:value-of> element below retrieves the name of the product with an XPath expression that selects products from the XML product_list section where the id attribute matches the id attribute of the current order. This is analogous to an SQL join between the customer_order and customer_order_product tables from relational schema. Note that XPath denotes an attribute with use of the at symbol, @.
<xsl:value-of select=
<break msecs="500"/> 
The total of the order was
Next, we see the VoiceXML <sayas> element put to use. Whether or not this causes the contents to be rendered correctly as currency depends on the TTS engine used, and its support for pronunciation markup. The rest of the block repeats the previous technique to add order options to the inline <grammar> element.
<sayas class="currency">       
$<xsl:value-of select="total_charge"/>
The status of this order is       
<xsl:value-of select="order_status"/>.     
<grammar type="application/x-jsgf">       
list |       
product list |       
more information |       
frequently asked questions |       
questions |       
order status |       
<xsl:for-each select=
order number 
<xsl:value-of select="position()"/> |       
buy me     
<assign name="form_pointer" expr="'productList'"/>
<assign name="user_command" expr="userSaid"/>   
<goto next="#navigator"/>     

Page 2 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