dcsimg
August 21, 2018
Hot Topics:

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

  • March 14, 2002
  • 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=
"order_date/@sayas"/></sayas>.       
<break msecs="500"/>       
The order consisted of 
<xsl:for-each select="product">       
quantity 
<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=
"/myrubberbands/product_list/product[@id=current()/@id]"
/>       
<break msecs="500"/> 
</xsl:for-each>       
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"/>
</sayas>.       
The status of this order is       
<xsl:value-of select="order_status"/>.     
</prompt>     
<grammar type="application/x-jsgf">       
list |       
product list |       
more information |       
frequently asked questions |       
questions |       
order status |       
<xsl:for-each select=
"/myrubberbands/customer_record/order_history/order">
order number 
<xsl:value-of select="position()"/> |       
</xsl:for-each>       
buy me     
</grammar>     
<filled>       
<assign name="form_pointer" expr="'productList'"/>
<assign name="user_command" expr="userSaid"/>   
<goto next="#navigator"/>     
</filled>   
</field> 
</form> 
</xsl:for-each>




Page 2 of 5



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

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

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.

Sitemap

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