dcsimg
December 4, 2016
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 »

Finally, we come to the errorHandler form that is used by most of the handlers in the dialog. This error handler keeps a running count of the number of errors, and when four errors have occurred, it will apologize and disconnect the user. This isn't the friendliest way of handling errors, and is not suitable for a long-range solution that would more likely transfer the user to a human operator at this point. Not only that, but we'd probably want more sophisticated logic for processing errors, maybe using ECMAScript to vary the response according to the time elapsed since the last error.

<form id="errorHandler">   
<block>     
<assign name="session_error_count"           
expr="session_error_count + 1"/>     
<if cond="session_error_count &lt; 4">       
<prompt bargein="false" timeout="0.1s">         
I'm sorry, but I'm unable to understand you.       
</prompt>       
<if cond="session_error_count &gt; 2">         
<prompt bargein="false" timeout="0.1s">           
It seems I am having trouble.         
</prompt>       
</if>       
<goto next="#navigator"/>     
<else/>       
<prompt bargein="false" timeout="0.1s">         
I'm sorry, but I'm having a lot of difficulty 
understanding you. If you are currently in a noisy 
environment, please call back later.       
</prompt>       
<exit/>     
</if>   
</block> 
</form>
All that needs to be done now is to close the document, after including an empty template matching standalone <product_list> elements, to suppress any output from them. Without this, default XSLT templates would be applied that output text children of any elements that aren't explicitly matched by a template already.
</vxml> 
</xsl:template> 
<xsl:template match="product_list"/> 
</xsl:stylesheet>
We've now reached the end of our VoiceXML stylesheet.

Running the Stylesheet

Now it is time to run the stylesheet transform, and produce a complete VoiceXML document for one of our users. If you are using Saxon, enter the following command at the command prompt:

C:\> saxon customer_1.xml myrubberbands2vxml.xsl > customer_1.vxml

We are now ready for our VoiceXML interface to go live. This simply requires us to upload the result of our XSLT transformation to our chosen Voice gateway.



Page 4 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.

Sitemap | Contact Us

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