Excerpt: Early Adopter VoiceXML: VoiceXML with XSLT (HTML and WML), Part 3
Finally, we come to the errorHandler form that is used by most of the
<form id="errorHandler"> <block> <assign name="session_error_count" expr="session_error_count + 1"/> <if cond="session_error_count < 4"> <prompt bargein="false" timeout="0.1s"> I'm sorry, but I'm unable to understand you. </prompt> <if cond="session_error_count > 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 StylesheetNow 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