XHTML+Voice Profile 1.2

16 March 2004

This version:
http://www.voicexml.org/specs/multimodal/x+v/12/spec.html
Latest version:
http://www.voicexml.org/specs/multimodal/x+v/12/spec.html
Previous version:
http://www.ibm.com/software/pervasive/multimodal/x+v/11/spec.htm
Editors:
Jonny Axelsson, Opera Software <[email protected]>
Chris Cross, IBM <[email protected]>
Jim Ferrans, Motorola <[email protected] >
Gerald McCobb, IBM <[email protected]>
T. V. Raman, IBM <[email protected]>
Les Wilson, IBM <[email protected]>

Abstract

The XHTML+Voice profile brings spoken interaction to standard web content by integrating the mature XHTML and XML-Events technologies with XML vocabularies developed as part of the W3C Speech Interface Framework. The profile includes voice modules that support speech synthesis, speech dialogs, command and control, and speech grammars. Voice handlers can be attached to XHTML elements and respond to specific DOM events, thereby reusing the event model familiar to web developers. Voice interaction features are integrated with XHTML and CSS and can consequently be used directly within XHTML content.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document.

Note that the language profile described in this specification re-uses W3C working drafts that are likely to change. This integration profile will be updated as needed to use the final stable versions of these specifications. This profile is an update to the XHTML+Voice 1.1 profile. XHTML+Voice 1.2 is current with the VoiceXML 2.0 Recommendation.

Errata

The list of known errors in this specification is available at xhtml-voice12-errata.html. Please report errors in this document to [email protected].

Table of Contents

1 Introduction
    1.1 Motivation And Applications
    1.2 Design Principles
    1.3 XHTML+Voice Processing Model
        1.3.1 Processing within one Document
            1.3.1.1 Language and Version
            1.3.1.2 VoiceXML Scope within XHTML+Voice
            1.3.1.3 VoiceXML Dialog Activation
            1.3.1.4 Accessing Speech Dialog Results from XHTML
            1.3.1.5 Accessing XHTML from a Speech Dialog
            1.3.1.6 Returning from a VoiceXML Form
        1.3.2 Cancel
        1.3.3 Declarative Synchronization of Input Modes
        1.3.4 Events and Event Handling
        1.3.5 Document Linking with Voice
        1.3.6 Aural Style Sheets
2 VoiceXML 2.0 Modules
    2.1 Modularization Of VoiceXML 2.0
    2.2 Speech Dialogs
    2.3 Executable Content
    2.4 Speech Grammars
    2.5 Speech And Non-speech Audio Output
    2.6 Event Handling
3 XHTML Modularization
    3.1 Document Conformance
    3.2 User Agent Conformance
    3.3 XHTML Namespace Integration
    3.4 XHTML+Voice Profile
    3.5 XHTML+Voice Abstract Modules
        3.5.1 Abstract Modules
        3.5.2 Element content shorthands
        3.5.3 Attribute list shorthands
4 XML Events Module
    4.1 Listener
    4.2 Event Types
        4.2.1 DOMActivate
    4.3 XHTML+Voice Event Propagation
5 XHTML+Voice Extension Module
    5.1 Sync
        5.1.1 Standard Grammars for XHTML Controls
    5.2 Cancel
    5.3 VoiceXML Field ID Attribute
    5.4 VoiceXML Prompt SRC and EXPR Attributes
        5.4.1 Styling External Prompt Resources
        5.4.2 Invalid Prompt Resource
        5.4.3 Prompt Resource Fetching Properties

Appendices

A Reusable VoiceXML
B Examples
    B.1 What You See Is What You Can Say
    B.2 Mixed-initiative Conversational Interface
    B.3 Speech-Enabled Mail Interface
    B.4 Reusable VoiceXML Subdialogs
C FIA for XHTML+Voice
D DTD
    D.1 xhtml+voice12.dtd
E Schema
    E.1 xhtml+voice12.xsd
F VoiceXML Container for the XHTML+Voice Subset
    F.1 vxml20-xvsubset.xsd
G Multimodal Auto Fill
H Changes from XHTML+Voice 1.1
    H.1 Modified Elements
    H.2 Clarifications
    H.3 Miscellaneous
I References
    I.1 Normative References
    I.2 Informative References


1 Introduction

This document defines version 1.2 of the XHTML+Voice profile. XHTML+Voice 1.2 is a member of the XHTML family of document types, as specified by XHTML Modularization [XHTML Modularization]. XHTML is extended with a modularized subset of VoiceXML 2.0, the XML Events module, and a module containing a small number of attribute extensions to both XHTML and VoiceXML. The latter module facilitates the sharing of multimodal input data between the VoiceXML dialog and XHTML input and text elements.

The XML Events module [XML Events] provides XML host languages the ability to uniformly integrate event listeners and associated event handlers with Document Object Model (DOM) Level 2 [DOM2 Events] event interfaces. The result is an event syntax for XHTML-based languages that enables an interoperable way of associating behaviors with document-level markup.

VoiceXML [VoiceXML 2.0] has been designed for creating audio dialogs that feature synthesized speech, digitized audio, recognition of spoken and DTMF key input, recording of spoken input, telephony, and mixed-initiative conversations. In this document, VoiceXML 2.0 is modularized to prepare it for integration into the XHTML family of languages using the XHTML modularization framework. The modules that combine to support speech dialogs for updating XHTML forms and form elements are selected to be added to XHTML. The modules are described as well as the integration issues. The modularization of VoiceXML 2.0 also specifies DOM event types specific to voice interaction for use with the XML Events module. Speech dialogs authored in VoiceXML 2.0 can then be treated as event handlers to add voice-interaction specific behaviors to XHTML documents. The language integration supports all of the modules defined in XHTML Modularization, and adds speech interaction functionality to XHTML elements to enable multimodal applications. The document type defined by the XHTML+Voice profile is XHTML Host language document type conformant.

1.1 Motivation And Applications

Two mature technologies, XHTML 1.1 [XHTML 1.1] and VoiceXML 2.0 [VoiceXML 2.0] are integrated using [XHTML Modularization] to bring spoken interaction to the visual web. The design leverages open industry APIs like the W3C DOM to create interoperable web content that can be deployed across a variety of end-user devices. Multiple modes of interaction are synchronized and integrated using the DOM 2 Events model [DOM2 Events] and exposed to the content author via XML Events [XML Events].

Today, web applications are authored in XHTML with user interaction created via XHTML form elements. The W3C is presently working on XForms [XForms], the next generation of web forms that bring the power of XML to web application development. The combination of XHTML and Voice described in this document can leverage the semantic richness of web applications created using XForms, while providing a smooth transition for today's developers wishing to deploy multimodal applications by adding spoken interaction to present-day web content. Integrating the work of the W3C voice browser working group into mainstream XHTML content has the advantage of ensuring that future enhancements to the voice browser component such as natural language understanding will be incorporated. Thus, a smooth transition path for web developers wishing to deliver increasingly smart user interaction for their web applications is provided. Building on XHTML Basic [XHTML Basic] and XHTML modularization, content developers will be able to deploy their content to a wide variety of end-user clients ranging from mobile phones and small PDAs to desktop browsers.

1.2 Design Principles

XHTML+Voice is an XML application [XML 1.0].

  1. XHTML is the host language.
  2. XHTML+Voice extends XHTML Basic with a subset of VoiceXML 2.0, as well as XML Events and a small extension module.
  3. XHTML+Voice makes authoring easy for common types of multimodal interactions.
  4. VoiceXML is modularized to permit the creation of profiles that match different application deployment environments.
  5. Those parts of VoiceXML that relate to the VoiceXML document being a stand-alone speech application are omitted from the XHTML+Voice profile.
  6. VoiceXML modularization does not alter the VoiceXML execution model. Specifically, a speech dialog is run as specified by the VoiceXML form interpretation algorithm.
  7. VoiceXML modularization does not modify the function of the VoiceXML 2.0 elements and attributes that are part of the profile.

1.3 XHTML+Voice Processing Model

XHTML+Voice is designed for creating multimodal dialogs that combine the visual input mode, represented by XHTML, and speech input and output, represented by a subset of VoiceXML. Here is a "Hello World" example of XHTML+Voice:

<?xml version="1.0"?>
<html 
xmlns="http://www.w3.org/1999/xhtml" 
xmlns:vxml="http://www.w3.org/2001/vxml"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xv="http://www.voicexml.org/2002/xhtml+voice"
>
  <head>
    <title>XHTML+Voice Example</title>
    <!-- voice handler -->
    <vxml:form id="sayHello">
      <vxml:block><vxml:prompt xv:src="#hello"/>
      </vxml:block>
    </vxml:form>
  </head>
  <body>
    <h1>XHTML+Voice Example</h1>
    <p id="hello" ev:event="click" ev:handler="#sayHello">
      Hello World!
    </p>
  </body>
</html>

The speech dialog identified by "sayHello" is activated when the user clicks anywhere on the paragraph identified by "hello." The speech dialog is a VoiceXML form that synthesizes the text obtained from the same paragraph that activated the form. The speech output is "Hello World!"

1.3.1 Processing within one Document

A speech dialog is defined within XHTML+Voice as a [VoiceXML 2.0] form with a unique ID. The VoiceXML form is activated by an XML Events event with an associated handler that references the form's unique ID. The XML Events event is generated from a user interaction with an XHTML element, generally a form control, or from a document event such as load or unload. Activating the VoiceXML form sets all form and field item variables to their initial values. This clears the guard conditions on all form items that don't have an initial value set with the expr attribute. The form is run according to the form interpretation algorithm (FIA) specified by VoiceXML.

1.3.1.1 Language and Version

A VoiceXML form requires language and VoiceXML version information. VoiceXML 2.0 includes language and version attributes with its root <vxml> element. XHTML+Voice obtains language and VoiceXML version from XHTML as follows. Language is obtained from the HTML root element's xml:lang attribute, while the VoiceXML version can be derived from the value of the VoiceXML namespace. The language can be overriden by the xml:lang attribute on the VoiceXML grammar and prompt tags.

1.3.1.2 VoiceXML Scope within XHTML+Voice

A VoiceXML form within an XHTML+Voice document does not have the session and document scopes defined by VoiceXML. It does not have these scopes for two reasons. First, <form> is the top level VoiceXML element in an XHTML+Voice document. Second, XHTML+Voice does not allow transitions from one voice handler to another. VoiceXML 2.0 allows a form to have either dialog or document scope. If the form's scope is document, as set by the scope attribute, the form is active while another form in the document is running. When the speech input matches the grammar of the form with document scope, there is a transition from the currently running form to the form with the document scope. XHTML+Voice does not allow this transition. Consequently, a form's scope is limited to dialog and the scope attribute is ignored. The grammar scope attribute is also ignored for the same reason. The remaining inner VoiceXML scopes, dialog and anonymous, are processed by XHTML+Voice, as required by the VoiceXML FIA.

While XHTML+Voice only supports the default value of the scope attribute, which is "dialog," if the scope attribute is encountered on a voice handler form the form is not invalidated and processing continues. The scope attribute on the <grammar> element is also ignored and its default value of "dialog" maintained. XHTML+Voice document processing ignores all VoiceXML 2.0 attributes it does not support when they are encountered.

If XHTML+Voice document processing encounters a VoiceXML 2.0 element not supported by XHTML+Voice (e.g., <goto>), a "badfetch" error is thrown. This means that a VoiceXML 2.0 interpreter and an XHTML+Voice interpreter can run the same VoiceXML 2.0 source if all the source tags are supported by XHTML+Voice. However, all the source attributes do not need to be supported by XHTML+Voice as XHTML+Voice supports their default values.

XHTML+Voice allows a speech dialog to be referenced as a voice handler in an external file. Because the speech dialog has no scope outside of its enclosing form, only the form in the external file is processed when the form is activated. For example, the script elements in the external file will not be processed. This is because the visual browser only executes script in the current document, and the VoiceXML <script> element is not supported. This requires the external reference to contain a fragment identifer specifying the form in addition to an absolute or relative URI. This differs from VoiceXML, which specifies that when the fragment is absent, the form "invoked is the lexically first dialog in the document" [VoiceXML 2.0]. With this restriction, the speech dialog can reside in any external XML document, including VoiceXML. Only the calling document has to be an XHTML+Voice document.

Because XHTML script placed in an external file is not processed, validation of VoiceXML results cannot be performed within an external subdialog by calling out to some ECMAScript contained within a VoiceXML script tag. ECMAScript validation of subdialog results can only be performed from the calling document. Validation methods must be included in the ECMAScript objects passed as parameters to the subdialog.

VoiceXML <field>, <subdialog>, and <var> elements do not have any visibility to the XHTML namespace as ECMAScript variables. Furthermore, there is no requirement to support the VoiceXML elements as nodes in the DOM object available to JavaScript. There are several problems with supporting the DOM object. Unlike XHTML form control elements, VoiceXML form item elements don't have a value attribute and consequently the DOM node value property is missing. A value attribute is necessary because the VoiceXML form item elements are their own ECMAScript variables, and they have defined values only while the enclosing form is active. At all other times their values are undefined.

1.3.1.3 VoiceXML Dialog Activation

When the browser loads the body of an XHTML+Voice document a "load" event is generated. This begins the event cycle specified by the DOM Level 2 Events model. While the event cycle is running events propagate through the HTML tree. An XML Events listener can observe an event on either a target HTML node, or an ancestor of the node, if the event bubbles. An XML Events listener activates a handler in response to the observed event. The handler can be a voice dialog activated in response to a "click" event on an HTML input, for example.

A voice dialog can also be activated by dispatching a DOMActivate event against it from XHTML script. The XML Events Module provides more details and an example.

1.3.1.4 Accessing Speech Dialog Results from XHTML

Speech dialog results may be accessed from XHTML in one of the following ways:

  1. The VoiceXML standard application variables are available to an XHTML+Voice application as global JavaScript variables. Each variable listed is an array of elements [0..i..n], where each element represents a possible result. See [VoiceXML 2.0] for more details:
    • application.lastresult$[i].confidence
    • application.lastresult$[i].utterance
    • application.lastresult$[i].inputmode
    • application.lastresult$[i].interpretation
  2. The XHTML+Voice <sync> element is described in XHTML+Voice Extension Module.
1.3.1.5 Accessing XHTML from a Speech Dialog

The global JavaScript scope of an XHTML+Voice document is available to a speech dialog. For example, an XHTML form control element, such as input, can be accessed from within VoiceXML using the DOM object traversal notation available to JavaScript. For example, the value of an input field with name "from_city" is set from the VoiceXML assign tag as follows:

<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ev="http://www.w3.org/2001/xml-events">
  <head>
    <form id="form_id" xmlns="www.w3.org/2001/vxml">
      <field name="from_field">
        <filled>
          <assign name="document.main.from_city.value"
                  expr="from_field"/>
        </filled>
      </field>
    </form>
  </head>
  <body>
    <form name="main" action="cgi/city.jsp">
      <input name="from_city" type="text"
		 ev:event="focus" ev:handler="#form_id"/>
    </form>
  </body>
</html>

The document keyword in XHTML+Voice refers to the JavaScript DOM object. This works because XHTML+Voice allows a voice dialog to share the global JavaScript scope with the XHTML container. XHTML+Voice also puts the VoiceXML application scope below the shared global scope.

1.3.1.6 Returning from a VoiceXML Form

When an event is captured within a voice dialog the author may choose to end the dialog and return to the XHTML container. XHTML+Voice uses the VoiceXML <return> element for this purpose. If the <return> element is run within executable content of a top level voice handler (i.e., one that is not called as a subdialog), the voice handler will end its execution and return to the XHTML. The following example shows how the <return> element can be used:

<?xml version="1.0"?> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:vxml="http://www.w3.org/2001/vxml"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xv="http://www.voicexml.org/2002/xhtml+voice" >
   <head><title>Find City or Airport</title> 
      <vxml:form id="vform">
         <vxml:subdialog name="cityorairport" src="cityorairport.vxml#cityform">
            <vxml:param name="paramPrompt" expr="'What city or airport?'"/> 
            <vxml:filled> 
               <vxml:assign name="document.xform.city.value"
                               expr="cityorairport.returnCityOrAirport"/>
            </vxml:filled> 
            <catch event="error.badfetch">
               Error fetching subdialog!
               <return/>
            </catch>
         </vxml:subdialog> 
      </vxml:form> 
   </head>
   <body bgcolor="#FFFFFF">
      <h3>City or Airport</h3>
      <form name="xform" action="cgi/cityorairport.jsp">
         <p>Enter city or airport:</br>
            <input type="text" name="city" ev:event="focus" ev:handler="#vform"/>
         </p>
      </form>
   </body>
</html>

When the <return> element is specified within a top-level voice form, its namelist attribute has no meaning and is ignored. However, either the event or eventexpr attribute can be used to return a VoiceXML event to the XHTML container.

1.3.2 Cancel

Multiple speech dialogs running simultaneously are not allowed by XHTML+Voice. A speech dialog runs in its own thread and, for many devices, the audio subsystem can be owned by only one thread at one time. Also, other resources that are not guaranteed to be thread-safe may cause a voice handler to indefinitely block. Therefore, only one speech dialog can be running at one time per loaded XHTML+Voice document. If only one speech dialog can be running at one time, the activating speech dialog must cancel the currently running dialog. This is the default behavior. The running dialog should also be canceled when the current XHTML+Voice document is unloaded.

The document author can cancel the currently running speech dialog with the <cancel> element that can be specified by an XHTML element as a handler for an XML Events event. The XHTML+Voice Extension Module section provides more details.

Cancel is a message from the visual browser that must be handled by the VoiceXML FIA. It is separate from the cancel event supported by VoiceXML that cancels the currently running prompt. The cancel message from the visual browser modifies the FIA in the sense that it must be checked throughout the FIA, and if it is received then the FIA must terminate.

1.3.3 Declarative Synchronization of Input Modes

The XHTML+Voice <sync> element provides a declarative synchronization of XHTML form control elements and the VoiceXML <field> element. The <sync> element specifies the following behaviors. First, sync allows input from one speech or visual modality to set the field in the other modality. Second, setting the focus of an <input> element that is synchronized with a VoiceXML field updates the FIA to visit that VoiceXML field. This is useful when there are multiple fields within a VoiceXML form. Sync is both a message to the VoiceXML FIA from the visual browser, like cancel, and a message from the FIA to the visual browser. The XHTML+Voice Extension Module section provides more details.

1.3.4 Events and Event Handling

The nomatch, noinput, help, and error VoiceXML event types are propagated as XML Events events to XHTML. They can be linked to an XML Events handler using the XML Events syntax for specifying target, observer, event, and handler. The events are propagated regardless of whether the event has already been caught and handled properly within the VoiceXML form. The VoiceXML event types nomatch, noinput, help, and error propagate to the XHTML container as the XHTML+Voice event types vxmlnomatch, vxmlnoinput, vxmlhelp, and vxmlerror, respectively.

Within VoiceXML a chain of events can be created, where one event is caught and another event is thrown, and so on. Because the entire chain of events is propagated to XHTML, the application author should be careful not to chain multiple events of the same type. The VoiceXML error event subtypes error.semantic, error.badfetch, error.unsupport.element, etc., are propagated as the vxmlerror event type to XHTML. This is in accordance with the VoiceXML specification. This allows for the application to define additional error subtypes that can be handled by the visual browser. More general application-defined event types are also supported. If an application-defined event type is defined within the VoiceXML form, such as "foo.bar", then when that event is thrown within the form, it is propagated to XHTML as an XML Events event. For the example below, both the vxmlnoinput and foo.bar events are handled by the visual browser via the XML Events listener tag. Note that the VoiceXML form exits because the foo.bar event is not handled within the form.

<vxml:form id="ex1">
   <vxml:catch event="noinput">
      <vxml:throw event="foo.bar"/>
   </vxml:catch>
   <vxml:field name="f1">
      <vxml:grammar type="boolean"/>
      <vxml:prompt>Say yes or no</vxml:prompt>
   </vxml:field>
</vxml:form>
<ev:listener ev:observer="ex1" ev:event="vxmlnoinput" ev:handler="#h1"/>
<ev:listener ev:observer="ex1" ev:event="foo.bar" ev:handler="#h2"/>

In addition to the VoiceXML event types listed above, XHTML+Voice supports the vxmldone event type. The vxmldone event is generated when the currently running VoiceXML form completes without an error. All the event types that XHTML+Voice supports are listed in the XML Events Module.

1.3.5 Document Linking with Voice

Document linking with voice is available to the author. Given an XHTML+Voice document with the following <link> and <a> elements:

<link rel="glossary" title="Glossary" href="glossary.html"/>
<link rel="contents" title="Contents" href="contents.html"/>
<a href="chapter3.html" title="Next Page" rel="next">Next</a>
<a href="chapter1.html" title="Previous Page" rel="previous">Previous</a>
<a href="http://www.nytimes.com" title="New York Times">NY Times</a>

The following grammar can be produced, as shown below. The document author uses the rel attribute to enable document linking for a select set of <link> and <a> elements. For each element with a rel attribute, the rel and href attribute values are added to the grammar, where the rel value is what the user might say, and the href value is the corresponding URI. If the rel attribute is omitted the title attribute can be used for building a link activation grammar for all the <a> elements in the document.

#JSGF V1.0 iso-8859-1;
grammar document-links;
public <document-links> = Glossary {this.$value="glossary.html"}
             | Contents {this.$value="contents.html"}
             | Next Page {this.$value="chapter3.html"}
             | Previous Page {this.$value="chapter1.html"}
             | New York Times {this.$value="http://www.nytimes.com"};

The grammar scope of the grammar is document so that it is always active. While XHTML+Voice does not support authoring a grammar with document scope within a form, the multimodal browser should support grammars with document scope for document linking and command and control.

1.3.6 Aural Style Sheets

With the addition of the src and expr attributes to the VoiceXML <prompt> element, XHTML+Voice is able to support Aural style sheets declared according to [CSS2]. Within XHTML, a paragraph with id set to "warnPara" can be styled with the CSS "warn" class:

<p id="warnPara" class="warn">warning</p>

The CSS has visual and aural rules for class "warn." When the VoiceXML<form> processes a prompt with the src attribute set to that paragraph, the aural style rules for "warn" are invoked. The VoiceXML Prompt SRC and EXPR Attributes Section provides more details and a complete example.

2 VoiceXML 2.0 Modules

This section first modularizes VoiceXML 2.0 and then specifies the various VoiceXML 2.0 modules used in the creation of the XHTML+Voice profile.

2.1 Modularization Of VoiceXML 2.0

The files making up the modularization of the VoiceXML 2.0 SCHEMA are available as voice-xml-modules.zip and have been created to ease the process of integrating VoiceXML 2.0 and XHTML. These modules do not change the VoiceXML 2.0 language as specified by the voice browser working group of the W3C. This section gives a high-level overview of each module.

Table 1: VoiceXML Modules
Module Purpose Elements XHTML+Voice?
Events Events thrown by Voice XML processor catch help noinput nomatch error throw Y
Executable statements Statements for use in voice handlers assign clear var log reprompt Y
Filled Voice handlers invoked when a slot is filled. filled Y
Flow control Flow control constructs from VoiceXML if else elseif return Y
Forms Encapsulate voice dialogs form field record subdialog block initial Y
Miscellaneous Non-local transfers in VoiceXML exit goto link script submit N
Menus VoiceXML menus menu choice N
Object Foreign objects for VoiceXML object N
Resources Specifying resources for VoiceXML param property Y
Root VoiceXML stand-alone documents vxml meta metadata N
Enumerate Enumerate choices or options available to user enumerate Y
Option Specify option in a field option Y
Output Speech and audio output prompt value audio desc emphasis lexicon mark voice break prosody say-as sub phoneme p s meta metadata Y
Telephony Telephony control transfer disconnect N
User Input Speech input constructs from VoiceXML grammar lexicon example tag token item meta metadata one-of rule ruleref Y
Attributes Common attributes used in VoiceXML NA Y
Datatypes Common datatypes used in VoiceXML NA Y
Document Model Defines content model for VoiceXML elements NA N

2.2 Speech Dialogs

Modules vxml-exec-1.xsd, vxml-filled-1.xsd, vxml-resource-1.xsd, vxml-flow-1.xsd, vxml-enumerate-1.xsd, vxml-option-1.xsd, and vxml-form-1.xsd support authoring handlers that implement speech dialogs.

2.3 Executable Content

Modules vxml-filled-1.xsd, vxml-flow-1.xsd, vxml-exec-1.xsd, and vxml-resource-1.xsd declare constructs for use within voice handlers. The semantics of these constructs are as defined in the VoiceXML 2.0 specification.

2.4 Speech Grammars

The speech grammar modules provide constructs for authoring speech grammars as specified in VoiceXML 2.0. The modules are provided by the normative VoiceXML 2.0 SCHEMA and are unchanged: grammar-core.xsd, grammar.xsd, vxml-grammar-restriction.xsd, and vxml-grammar-extension.xsd. The restriction and extension modules allow the elements and attributes normatively specified by the speech grammar specification [Speech Grammars] to be included within the VoiceXML 2.0 namespace.

2.5 Speech And Non-speech Audio Output

The speech and audio output modules define constructs for producing spoken and non-spoken audio output. The modules are provided by the normative VoiceXML SCHEMA and are unchanged: synthesis-core.xsd, synthesis.xsd, vxml-synthesis-restriction.xsd, and vxml-synthesis-extension.xsd. As with the speech grammar modules, the elements and attributes normatively defined in the SSML specification [SSML 1.0] are included within the VoiceXML 2.0 namespace.

2.6 Event Handling

Module vxml-events-1.xsd declares the event types defined in VoiceXML 2.0.

3 XHTML Modularization

This section is normative.

3.1 Document Conformance

A conforming XHTML+Voice document is a document that requires only the facilities described as mandatory in this specification. Such a document must meet all of the following criteria:

  1. It must validate against the XML Schema found in schema provided in this document.

  2. The root element of the document must be html.

  3. The name of the default namespace on the root element must be the XHTML namespace name: http://www.w3.org/1999/xhtml.

  4. If a DOCTYPE declaration is present and includes a public identifier, the DOCTYPE declaration must reference the DTD provided in this document using its Formal Public Identifier. The system identifier may be modified appropriately.

    <!DOCTYPE html PUBLIC "-//VoiceXML Forum//DTD XHTML+Voice 1.2//EN"
    "http://www.voicexml.org/specs/multimodal/x+v/12/dtd/xhtml+voice12.dtd">

3.2 User Agent Conformance

The user agent must conform to the "User Agent Conformance" section of the XHTML specification [XHTML 1.0], section 3.2, and the conformance requirements detailed in the VoiceXML modules [VoiceXML 2.0] supported by the integration profile.

The user agent must conform to the following additional user agent rule:

  1. When the user agent claims to support facilities defined within the VoiceXML 2.0 specifications or facilities required by this specification through normative reference, it must do so in ways consistent with the facilities' definition.

3.3 XHTML Namespace Integration

The default XML namespace of an XHTML+Voice document is XHTML. XHTML+Voice extends XHTML with VoiceXML, XML Events, and XHTML+Voice extensions. The VoiceXML, XML Events, and XHTML+Voice extension elements and attributes are included through additional namespace declarations:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:vxml="http://www.w3.org/2001/vxml"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xv="http://www.voicexml.org/2002/xhtml+voice">

The name of the unique prefix identifier for the namespace within the document, for example, vxml for VoiceXML elements, is left to the document author's discretion.

3.4 XHTML+Voice Profile

The XHTML functionality in the XHTML+Voice document type is based upon the XHTML modules defined in [XHTML Modularization]. The XHTML+Voice profile includes the XHTML modules defined in [XHTML Basic], such as the basic XHTML forms and tables modules. Added to the XHTML Basic modules are the following modules:

  • The XHTML scripting module.
  • XML Events as defined by the XML Events module, [XML Events]. XML Events with VoiceXML event types and handlers allow the XHTML author to associate voice-interaction specific behaviors.
  • A set of VoiceXML modules for speech-enabling XHTML constructs. The top level VoiceXML element for defining a voice handler is <form>.
  • An XHTML+Voice Extension module for facilitating the authoring of the interaction between the visual and speech modules.

The notation, terms and document conventions used here are borrowed from [XHTML 1.1].

The profile includes the XHTML basic module defined in [XHTML Basic], the XHTML scripting module defined in [XHTML 1.1], the XML Events module defined in [XML Events], the XHTML+Voice extension module defined in the XHTML+Voice Extension Module, and the following VoiceXML 2.0 modules:

3.5 XHTML+Voice Abstract Modules

The namespaces used in these modules are as follows:

XHTML:
http://www.w3.org/1999/xhtml
VoiceXML:
http://www.w3.org/2001/vxml
XML Events:
http://www.w3.org/2001/xml-events
XHTML+Voice:
http://www.voicexml.org/2002/xhtml+voice

3.5.1 Abstract Modules

Table 2: XHTML+Voice Abstract Modules
Element Content Attributes
Base Module (XHTML)
base EMPTY href* (URI)
Basic Forms Module (XHTML)
form Heading | Block - form Common, action* (URI), method ("get"* | "post"), enctype (ContentType)
input EMPTY Common, Access, checked ("checked"), maxlength (Number), name (CDATA), size (Number), src (URI), type ("text"* | "password" | "checkbox" | "radio" | "submit" | "reset" | "hidden" ), value (CDATA)
label (PCDATA | Inline - label)* Common, accesskey (Character), for (IDREF)
select option+ Common, multiple ("multiple"), name (CDATA), size (Number)
option PCDATA Common, , selected ("selected"), value (CDATA)
textarea PCDATA Common, Access, cols* (Number), name (CDATA), rows* (Number)
Basic Tables Module (XHTML)
caption (PCDATA | Inline)* Common
table caption?, tr+ Common, summary (Text), width (Length )
td (PCDATA | Flow - table)* Common, Cell, Align
th (PCDATA | Flow - table)* Common, Cell, Align
tr td+ Common, Align
Enumeration Module (VoiceXML)
enumerate (Audio | TTS)* -
Events Module (VoiceXML)
catch Exec VoiceHandler, event (NMTOKENS)
help Exec VoiceHandler
noinput Exec VoiceHandler
nomatch Exec VoiceHandler
error Exec VoiceHandler
throw EMPTY VoiceHandler, event (NMTOKEN), eventexpr (Script), message (CDATA), messageexpr (Script)
Executable Statements Module (VoiceXML)
assign EMPTY Expr
clear EMPTY namelist (CDATA)
var EMPTY Expr
log (PCDATA | value)* label (CDATA), expr (Script)
reprompt EMPTY -
Filled Module (VoiceXML)
filled (Exec)* mode("any" | "all"*), namelist (CDATA)
Flow Control Module (VoiceXML)
if (Exec | elseif | else)* cond (Script)
else EMPTY -
elseif EMPTY cond (Script)
return EMPTY namelist (CDATA), event (NMTOKEN), eventexpr (Script), message (CDATA), messageexpr (Script)
Forms Module (VoiceXML)
form (Form)* id (ID)
field (Audio | EventHandler | filled | enumerate | grammar | link | vxml:option | prompt | property)* Item, type (GrammarType), slot (NMTOKEN ), modal (Boolean), xv:id (ID)
record (Audio | EventHandler | filled | grammar | prompt | property)* Item, type (ContentType), beep (Boolean), maxtime (Duration), modal (Boolean), dtmfterm (Boolean), finalsilence (Duration)
subdialog (Audio | filled | param | prompt | property)* Item, Cache, Submit, src (URI), srcexpr (Script), fetchaudio (URI)
block Exec Item
initial (Audio | EventHandler | link | prompt | property)* Item
Hypertext Module (XHTML)
a (PCDATA | Inline - a)* Common, Access, Linking, hreflang (LanguageCode)
Image Module (XHTML)
img EMPTY Common, Dim, alt* (Text), longdesc (URI), src* (URI)
Link Module (XHTML)
List Module (XHTML)
dl (dd | dt)+ Common
dt (PCDATA | Inline)* Common
dd (PCDATA | Flow)* Common
ol li+ Common
ul li+ Common
li (PCDATA |Flow)* Common
Metainformation Module (XHTML)
meta EMPTY I18N, content* (CDATA), http-equiv (NMTOKEN), name (NMTOKEN), scheme (CDATA)
Object Module (XHTML)
object (PCDATA | Flow | param)* Common, Dim, archive (URI), classid (URI), codebase (URI), codetype (ContentType), data (URI), declare ("declare"), name (CDATA), standby (Text), tabindex (Number), type (ContentType)
param EMPTY id (IDREF), name* (CDATA), type (ContentType), value (CDATA), valuetype ("data"* | "ref" | "object")
Option Module (VoiceXML)
vxml:option PCDATA dtmf (CDATA), value (CDATA)
Output Module (VoiceXML)
prompt (Audio | TTS | lexicon | meta | metadata)* I18N, VoiceHandler, bargein (Boolean), bargeintype ("speech" | "hotword"), timeout (Duration), xml:base (URI), version ("1.0"), xv:src (URI), xv:expr (CDATA)
value EMPTY expr (Script)
audio (Audio | TTS | desc)* Cache, src (URI), expr (Script)
desc PCDATA xml:lang (NMTOKEN)
lexicon EMPTY uri (URI), type (ContentType)
emphasis SentenceContent level ("strong" | "moderate"* | "none" | "reduced")
voice (SentenceContent | Structure)* I18N, gender ("male" | "female" | "neutral"), age (Number), variant (Number), name (CDATA)
break EMPTY strength ("x-weak" | "weak" | "medium"* | "strong" | "x-strong" | "none"), time (Duration)
prosody (SentenceContent | Structure)* pitch (CDATA), contour (CDATA), range (CDATA), rate (CDATA), duration (Duration), volume (CDATA)
say-as (PCDATA | value)* interpret-as (NMTOKEN), format (NMTOKEN), detail (CDATA)
meta EMPTY name (NMTOKEN), content (CDATA), http-equiv (NMTOKEN)
metadata ANY  
phoneme PCDATA ph (CDATA), alphabet (CDATA)
p (SentenceContent | s)* I18N
s SentenceContent I18N
sub PCDATA alias (CDATA)
mark EMPTY name (CDATA)
Resources Module (VoiceXML)
param EMPTY Expr, value (CDATA), valuetype ("data"* | "ref"), type (CDATA)
property EMPTY name (NMTOKEN), value (CDATA)
Scripting Module (XHTML)
script PCDATA charset (CharSet), defer ("defer"), src (URI), type* (ContentType), xml:space="preserve", declare ("declare")
noscript (Heading | Block | List)+ Common
Structure Module (XHTML)
body (Heading | Block | List)* Common
html head, body I18N, version (CDATA), xmlns (URI = "http://www.w3.org/1999/xhtml")
title PCDATA I18N
Text Module (XHTML)
abbr (PCDATA | Inline)* Common
acronym (PCDATA | Inline)* Common
address (PCDATA | Inline)* Common
blockquote (PCDATA | Heading | Block | List)* Common, cite (URI)
br EMPTY Core
cite (PCDATA | Inline)* Common
code (PCDATA | Inline)* Common
dfn (PCDATA | Inline)* Common
div (PCDATA | Flow)* Common
em (PCDATA | Inline)* Common
h1 (PCDATA | Inline)* Common
h2 (PCDATA | Inline)* Common
h3 (PCDATA | Inline)* Common
h4 (PCDATA | Inline)* Common
h5 (PCDATA | Inline)* Common
h6 (PCDATA | Inline)* Common
kbd (PCDATA | Inline)* Common
p (PCDATA | Inline)* Common
pre (PCDATA | Inline)* Common, xml:space="preserve"
q (PCDATA | Inline)* Common, cite (URI)
samp (PCDATA | Inline)* Common
span (PCDATA | Inline)* Common
strong (PCDATA | Inline)* Common
var (PCDATA | Inline)* Common
User Input Module (VoiceXML)
grammar (PCDATA | meta | metadata | lexicon | tag | rule)* Cache, I18N, version (NMTOKEN), root (IDREF), mode ("voice"* | "dtmf"), src (URI), scope ("document" | "dialog"), type (ContentType), weight (CDATA), tag-format (URI), xml:base (URI)
example PCDATA  
lexicon EMPTY uri (URI), type (ContentType)
tag PCDATA  
token PCDATA I18N
item (RuleExpansion)* I18N, weight (NMTOKEN), repeat (NMTOKEN), repeat-prob (NMTOKEN)
meta EMPTY name (NMTOKEN), content (CDATA), http-equiv (NMTOKEN)
metadata ANY  
one-of (item)+ I18N
rule (RuleExpansion | example)* id (ID), scope ("private"* | "public")
ruleref EMPTY uri (URI), type (ContentType), special ("NULL" | "VOID" | "GARBAGE")
XML Events Module (XML Events)
listener EMPTY XEvents
XHTML+Voice Extension Module (XHTML+Voice)
sync EMPTY

input (NMTOKEN), field (URI), html-form-id (IDREF)

cancel EMPTY

id (ID), voice-handler (URI)

Elements Attributes  
vxml:field& id (ID)  
vxml:prompt& src (URI) | expr (CDATA)  

3.5.2 Element content shorthands

Table 3: Element Entities and Content
Element Entities Content
Audio (VoiceXML) PCDATA | audio | value | enumerate
Block (XHTML) address | blockquote | div | p | pre
EventHandler (VoiceXML) catch | help | noinput | nomatch | error
Exec (VoiceXML) Audio | assign | clear | if | log | prompt | reprompt | return | throw | var
Flow (XHTML) Heading | List | Block | Inline
Form (VoiceXML) EventHandler | grammar | filled | initial | property | record | subdialog | Variable
Heading (XHTML) h1 | h2 | h3 | h4 | h5 | h6
Inline (XHTML) a | abbr | acronym | button | br | cite | code | dfn | em | img | input | kbd | label | object | q | samp | select | span | strong | textarea
RuleExpansion (VoiceXML) PCDATA | token | ruleref | item | one-of | tag
SentenceContent (VoiceXML) Audio | SentenceElements
SentenceElements (VoiceXML) break | emphasis | phoneme | mark | prosody | say-as | voice | sub
Structure (VoiceXML) s | p
TTS (VoiceXML) SentenceElements | Structure
Variable (VoiceXML) block | field | var

3.5.3 Attribute list shorthands

Table 4: Attribute Entities and Content
Attribute Entities Content
Access (XHTML) accesskey (Character), tabindex (Number)
Align (XHTML) align ("left" | "center" | "right"), valign ("top" | "middle" | "bottom")
Cache (VoiceXML) fetchhint ("prefetch" | "safe"), fetchtimeout (Duration, maxage (Number), maxstale (Number)
Cell (XHTML) abbr (Text), axis (CDATA), colspan (Number), headers (IDREFS), rowspan (Number), scope ("row" | "col")
Common (XHTML) Core, Events, XEvents
Core (XHTML) class (NMTOKENS), id (ID), title (CDATA )
Dim (XHTML) height (Length ), width (Length)
Events (XHTML) MouseEvents , KeyEvents
Expr (VoiceXML) name (VarName), expr (Script )
I18N (XML) xml:lang (NMTOKEN)
Item (VoiceXML) name (VarName), cond (Script), expr (Script)
KeyEvents (XHTML) onkeypress (Script), onkeydown (Script), onkeyup (Script)
Linking (XHTML) charset (CharSet), href (URI), hreflang (LanguageCode), rel (LinkTypes), rev (LinkTypes), type (ContentType)
MouseEvents (XHTML) onclick (Script), ondblclick (Script), onmousedown (Script), onmouseover (Script), onmousemove (Script), onmouseout (Script)
Style (XHTML) style (CDATA )
VoiceHandler (VoiceXML) count (Number), cond (Script)
XEvents (XML Events) event, observer (IDREF), handler (URI), target (IDREF), phase ("capture" | "default"*), propagate ("stop" | "continue"*), defaultAction("cancel" | "perform"*), id

Attribute types

Table 5: Attribute Types
Attribute Type Description
Boolean "true" | "false"
Duration A positive real number followed by either 's' (seconds) or 'ms' (milliseconds)
GrammarType CDATA
VarName NMTOKEN or NMTOKEN with "$" appended

4 XML Events Module

4.1 Listener

XHTML+Voice extends XHTML with the XML Events <listener> element and its attributes. The <listener> attributes are added to XHTML elements primarily for activating voice handlers. The <listener> element and attributes belong to the XML Events namespace:

xmlns:ev="http://www.w3.org/2001/xml-events"

4.2 Event Types

For a given XML language extended with XML Events, a set of event types must be specified independently of the [XML Events] module. The XML Events event types supported by the XHTML+Voice profile include all event types defined for [HTML 4.01] intrinsic events. VoiceXML handler activation is specified by including, with an XHTML element, one of these event types as an XML Events event and an ID reference to the VoiceXML form as an XML Events event handler.

The XHTML+Voice profile supports the following VoiceXML 2.0 event types: nomatch, noinput, error, and help. These event types are emitted to the XHTML container as the following XHTML+Voice event types: vxmlnomatch, vxmlnoinput, vxmlerror, and vxmlhelp, respectively. The VoiceXML exit and cancel event types are supported within the VoiceXML form but are not propagated to the visual browser. Event types defined by the author within VoiceXML, also known as application-defined event types, are also propagated to the visual browser. However, the VoiceXML <form> element does not support adding the XML Events attributes.

An additional XHTML+Voice event type, "vxmldone", is supported. The vxmldone event is generated when the voice handler completes.

The XHTML+Voice profile extends the XHTML <script> element with XML Events. The <script> element doesn't generate any events of its own, so the observer attribute is required to specify observing an XML Events event on another node in the XHTML tree. The <script> element can observe any HTML 4.01 intrinsic event or VoiceXML event. Here is an example of how a <script> element can be a handler for a "vxmldone" event. The value of XHTML input "drink" is updated when the voice handler "fid" completes:

<?xml version="1.0"?>
<html xmlns="www.w3.org/1999/xhtml"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:vxml="http://www.w3.org/2001/vxml"
      xmlns:xv="http://www.voicexml.org/2002/xhtml+voice" >
  <head><title>Script Event Handler</title>
    <script type="text/javascript" 
      ev:event="vxmldone" ev:observer="fid" declare="declare">
      document.xform.drink.value = application.lastresult$[0].utterance;
    </script>
    <vxml:form id="fid">
      <vxml:field name="f1">
        <vxml:grammar src="drink.gram"/>
        <vxml:prompt>Coffee, tea, or milk?</vxml:prompt>
      </vxml:field>
    </vxml:form>
  <body>
    <form id="xform" action="cgi/submit">
      <input type="text" id="drink" ev:event="focus" ev:handler="#fid"/>
    </form>
  </body>
</html>

Note that the "declare" attribute is necessary to prevent the <script> contents from being evaluated on document load.

The following table matches the XHTML+VoiceXML event types with the XHTML or VoiceXML elements that support them. When the <listener> event attribute is added to an XHTML element, it must specify a event type supported by the element in the right-hand column. Because the HTML 4.01 event types have been translated into XML Events event types, the "on" prefix for these event types has been removed.

Table 6: XHTML+VoiceXML Event Types
Elements Event Type
XHTML body load, unload
Most XHTML elements click, dblclick, mousedown, mouseup, mouseover, mouseout, keypress, keydown, keyup
XHTML elements: a, label, input, select, textarea, button focus, blur
XHTML form submit, reset
XHTML elements: input, textarea select
XHTML elements: input, select, textarea change
VoiceXML form vxmlnomatch, vxmlnoinput, vxmlerror, vxmlhelp, vxmldone, "user defined"

4.2.1 DOMActivate

A voice handler can be activated by dispatching a DOMActivate event against it within an XHTML <script> element. Here is an example that shows how a voice handler can be activated by a script event handler in response to a "click" event observed on a <paragraph> element.

<?xml version="1.0"?> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:vxml="http://www.w3.org/2001/vxml"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xv="http://www.voicexml.org/2002/xhtml+voice" >
   <head><title>Find City or Airport</title> 
      <script ev:event="click" 
                 ev:observer="prompt" declare="declare">
         var e = document.createEvent("UIEvents");
         e.initEvent("DOMActivate","true","true");
         document.getElementById("vform").dispatchEvent(e);        
      </script>
      <script ev:event="vxmlhelp"
                 ev:observer="vform" declare="declare">
         alert('Say a U. S. city or airport name');
      </script>
      <xv:sync xv:name="city" xv:field="cityorairport"/>
      <vxml:form id="vform">
         <vxml:field name="cityorairport" xv:id="cityorairport">
            <vxml:prompt xv:src="#prompt"/> 
            <vxml:grammar src="grams/cityorairport.gram"/> 
            <catch event="noinput nomatch">
               For example, say Chicago O'Hare. 
            </catch>
         </vxml:field> 
      </vxml:form> 
   </head>
   <body bgcolor="#FFFFFF">
      <h3>City or Airport</h3>
      <form name="xform" action="cgi/cityorairport.jsp">
         <p id="prompt">Enter city or airport:</br>
            <input type="text" name="city"/>
         </p>
      </form>
   </body>
</html>

Whenever a voice handler is activated by a DOMActivate event, the VoiceXML events generated by the voice handler can be observed on the VoiceXML <form> element itself. In the example above a <script> element observes the "vxmlhelp" event on the VoiceXML form.

A voice handler can also be canceled in a similar mannar by creating and dispatching a DOMActivate event against the XHTML+Voice <cancel> element. Note that the result of dispatching a DOMActivate event before the "load" event occurs is undefined.

4.3 XHTML+Voice Event Propagation

XML Events events in an XHTML+Voice document propagate within the XHTML tree. The following diagram shows the capture and bubbling phases of an XML Events event as it travels from the HTML root tag to the target input tag, and from the target input tag back to the HTML root. The flow of events shown could be in response to the user clicking on a text input control.

Flow of XML Events in XHTML+Voice
Event flow in X+V

For an XML Events event emitted from a VoiceXML form, the target of the event is the XHTML element that activated the VoiceXML form. This allows a listener to observe a VoiceXML event, such as vxmldone, on the XHTML form or body element, where the target is an input element contained by the form. Here is an example that shows how the vxmldone event can be observed on the XHTML body element.

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//VoiceXML Forum//DTD XHTML+Voice 1.2//EN"
"http://www.vxmlforum.org/specs/multimodal/x+v/12/dtd/xhtml+voice12.dtd">
<html xmlns="http://www.w3.or/1999/xhtml"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:vxml="http://www.w3.org/2001/vxml">
<head><title>Flight Information</title>
<script>
  var sel = "";
</script>
<script id="selectFlight" ev:event="vxmldone" 
           ev:observer="bodyelm" declare="declare">
   alert("You selected "+sel);
</script>
<vxml:form id="flightform">
   <vxml:field name="flightno">
    <vxml:prompt>Say a flight number.</vxml:prompt>
    <vxml:grammar> <![CDATA[
	#JSGF V1.0;
	grammar flight_number;
	public <flight> = American 1246 {$="American flight 1246"}
                        | Delta 590 {$="Delta flight 590"}
                        | United 480 {$="United flight 480"};
	]]></vxml:grammar>   
    <vxml:catch event="help nomatch noinput">
       Say United 480, for example.
    </vxml:catch>
  </vxml:field>
  <vxml:filled>
     <vxml:assign name="sel" expr="flightno"/>
  </vxml:filled>
</vxml:form>
</head>
<body id="bodyelm">
  <table>
    <thead>
    <td>flight no</td><td>Depart city</td><td>Arrive City</td>
    <td>Depart Time</td><td>Arrive Time</td>
    </thead>
    <tr>
      <td><a href="" ev:event="focus" ev:handler="#flightform">
      American 1246</a></td><td>Miami</td><td>New York</td>
      <td>10:50 AM</td><td>3:20 PM</td>
    </tr>
  </table>
</body>
</html>

5 XHTML+Voice Extension Module

The XHTML+Voice Extension module extends XHTML+Voice 1.0 with the <sync> element, <cancel> element, the src and expr attributes of the VoiceXML <prompt> element, and the id attribute of the VoiceXML field element. The element and attributes in this module belong to their own namespace:

xmlns:xv="http://www.voicexml.org/2002/xhtml+voice"

5.1 Sync

The XHTML+Voice <sync> element adds support for synchronization of data entered via either speech or visual input. It synchronizes the value property of an XHTML input control with a VoiceXML field, as follows:

  1. Speech dialog results are returned to both the VoiceXML field and the XHTML <input> element.
  2. Keyboard data entered into the <input> element updates both the VoiceXML field and the XHTML <input> element.
  3. Keyboard data entered into the <input> element satisfies the guard condition on the VoiceXML field.
  4. For an active VoiceXML form with multiple fields, if the user gives focus to the input field, the FIA is instructed to visit the referenced VoiceXML field as the next item. This includes the mixed initiative case.

Sync does not activate a voice handler. If the <sync> element has specified an XHTML input control but no VoiceXML form is currently active, nothing will happen. If an event and event handler are also specified, then when the user clicks on the input control the VoiceXML form is activated and the guard conditions of the VoiceXML form items are cleared. The XHTML input control is not cleared if data is already there.

Only changes made while a VoiceXML form is active are synchronized. An existing XHTML input value does not update the synchronized VoiceXML <field> when the VoiceXML form is activated.

The <sync> element attributes are:

Table 7: <sync> attributes
input The name of an XHTML input control.
field A URI reference to a field ID within a VoiceXML form.
html-form-id A reference to the ID of the XHTML form enclosing the input field.

The type of the input attribute is NMTOKEN. The type of the field attribute is URI. The URI must include a fragment identifier that references a VoiceXML <field> ID. If the <field> element is in an external file, then the fragment identifier is appended to the URI.

Only the html-form-id attribute is optional. If this attribute is omitted from the <sync> element, the XHTML input field is assumed to be enclosed by the first XHTML form in the document, in document order. The type of the html-form-id attribute is IDREF.

The What You See Is What You Can Say and Mixed-initiative Conversational Interface examples both use the <sync> element to synchronize XHTML inputs and VoiceXML fields.

5.1.1 Standard Grammars for XHTML Controls

A VoiceXML field is filled when the user's utterance matches a word or phrase in the field's grammar. The grammar, along with [Semantic Interpretation], determines how the VoiceXML field is filled and can be used to determine how a field's contents updates an arbitrary XHTML control, or group of controls, using <sync>. Standardizing the grammars enables a straight-forward algorithm for updating an XHTML input control based on the contents of a VoiceXML <field>.

The following standard grammars are used with the <sync> element for synchronizing XHTML controls with the following property types: radio button and radio group, checkbox and checkbox group, hidden, password, file, text, textarea, select-one, select-multiple, submit, reset, and button.

Here is an example of a grammar for a single selection list (i.e., <select>) and a radio group (i.e., multiple XHTML inputs of type "radio" with the same name).

<![CDATA[
  #JSGF V1.0;
  grammar crust;
  public <crust> = thin | medium | thick | chicago [style] | cheese;
]]>

Here is an example of a grammar for a multiple selection list (i.e., <select multiple="multiple">) and a checkbox group (i.e., multiple XHTML inputs of type "checkbox" with the same name). Each selected item is pushed onto an array. The filled VoiceXML field is an array containing the selected items.

<![CDATA[
  #JSGF V1.0;
  grammar meat_toppings;
  <meats> = bacon | chicken | ham | meatball | sausage | pepperoni;
  public <toppings> = <NULL> { $= new Array; }
                  ( <meats> [and] { $.push($meats) } )+;
]]>

Here is an example of a grammar for a single radio button, checkbox, or button (button includes the submit and reset buttons). For the radio button or checkbox, the "checked" attribute is toggled according to the semantic interpretation tag contained in the filled VoiceXML field. For the button input type, a semantic interpretation value of "true" causes the button to be clicked.

<![CDATA[
  #JSGF V1.0;
  grammar pizza_extra;
  public <yesno> = no {$=false} | nope {$=false} | next {$=false} | 
                                 yes {$=true} | o k {$=true};
]]>

The grammar for the text, textarea, password, hidden, and file input types does not require any semantic interpretation. The contents of the filled VoiceXML field is set to the value attribute of these input types. Here is an example:

<![CDATA[
  #JSGF V1.0;
  grammar one_twenty;
  public <onetotwenty> = 1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20;
]]>

The user should always have the option of saying "none" or "next" to decline updating the XHTML control. This is supported by adding a grammar to the VoiceXML field which is outside of the standard grammar used for that field. Here is an example of a grammar, added to the grammar for a multiple selection list, that allows the user to say "none" or "skip":

<grammar>
  <![CDATA[
    #JSGF V1.0;
    grammar meat_toppings;
    <meats> = bacon | chicken | ham | meatball | sausage | pepperoni;
    public <toppings> = <NULL> { $= new Array; }
                  ( <meats> [and] { $.push($meats) } )+;
  ]]>
</grammar>
<grammar>
  <![CDATA[
    #JSGF V1.0;
    grammar no_sel;
    public <no_sel> = none | next | skip;
  ]]>
</grammar>

Note that the above example grammars are JSGF, but the grammars can be in any standard format supported by VoiceXML 2.0, including the SRGS elements.

5.2 Cancel

The XHTML+Voice <cancel> element allows a document author to cancel a running speech dialog. It is a stand-alone element with no content that can be referenced as an XML Events event handler.

The <cancel> element attributes are:

Table 8: <cancel> attributes
id Unique document identifier.
voice-handler A URI reference to a VoiceXML form ID.

The id attribute is required. The type of the id attribute is ID.

The voice-handler attribute is optional. The type of the voice-handler attribute is URI. The URI must include a fragment identifier that references a VoiceXML <form> ID. If the <form> element is in an external file, then the fragment identifier is appended to the URI. If the voice-handler attribute is omitted, then the currently running speech dialog is canceled. If voice-handler is specified, then only the specified voice handler is canceled.

<head><title>Cancel Example</title>
...
<xv:cancel id="cid1" xv:voice-handler="#fid1"/>
<xv:cancel id="cid2"/>
</head>
<body>
...
<input type="reset" ev:event="click" ev:handler="#cid1"/>
<button ev:event="click" ev:handler="#cid2">Cancel Voice</button> 

The example above shows how <cancel> can be used to cancel either a specific speech dialog or the currently running speech dialog. The reset button in the example cancels the speech dialog identified by "fid1." The "Cancel Voice" button cancels the currently running dialog because the handler attribute is omitted from the <cancel> element that is activated when the button is clicked.

5.3 VoiceXML Field ID Attribute

XHTML+Voice adds an optional id attribute to the VoiceXML <field> element. The id attribute is used by the XHTML+Voice <sync> element's field attribute to uniquely specify a VoiceXML <field> element.

5.4 VoiceXML Prompt SRC and EXPR Attributes

XHTML+Voice extends the VoiceXML <prompt> element with two attributes, src and expr. The src attribute allows for the specification of a text source for speech output anywhere in the document or in an external document. In addition, the text source can be styled according to the aural styling rules defined in [CSS2]. For example, a style sheet may have the following styling rules for the XHTML <p> element:

P.romeo { voice-family: male; volume: loud; pause-before: 20ms; }
P.juliet { voice-family: female; volume: soft; }

A voice handler can play two prompts from two different text sources in the document, as follows:

<vxml:form id="sayHello">
  <vxml:block><prompt xv:src="#hello_romeo"/>
              <prompt xv:src="#hello_juliet"/>
  </vxml:block>
</vxml:form>
<body ev:event="load" ev:handler="#sayHello">
<p id="hello_romeo" class="juliet">
    Romeo, Romeo, where art thou?
</p>
<p id="hello_juliet" class="romeo">
    I am here.
</p>
</body>

The first prompt plays a soft female voice. The second prompt plays a loud male voice after a 20 ms pause.

The expr attribute allows for the text source to be determined dynamically. The value of the expr attribute is an expression that evaluates to a URI with a fragment identifier. Both the URI referenced by src and the URI resolved by expr include a fragment identifier that references the id attribute of an XML element containing text for the prompt. The type of the src attribute is URI and the type of the expr attribute is CDATA. Exactly one of src or expr may be specified; if both are specified an error.badfetch event is thrown.

A voice handler can play a prompt from a text source determined dynamically by the expr attribute expression, as follows:

<vxml:form id="sayHello">
  <xvml:var name="count" expr="0"/>
  <vxml:block name="block_1">
     <vxml:prompt xv:expr="count == 0 ? '#hello_romeo' : '#hello_juliet'"/>
     <vxml:assign name="count" expr="count+1"/>
     <vxml:assign name="block_1" expr="undefined"/>
  </vxml:block>
</vxml:form>
<body ev:event="load" ev:handler="#sayHello">
<p id="hello_romeo" class="juliet">
    Romeo, Romeo, where art thou?
</p>
<p id="hello_juliet" class="romeo">
    I am here.
</p>
</body>

5.4.1 Styling External Prompt Resources

If the prompt resource is in an external file, the rules for styling the resource apply only to the retrieved XML element and its children. For example, the style attribute on the XML element should be honored, while style rules inherited from parent elements in the external document can be ignored. It is also the author's responsibility to reference the style sheets used to style the external resource in the originating document. Style sheet references in the external document can be ignored.

5.4.2 Invalid Prompt Resource

If the prompt resource cannot be played (e.g., 'src' referencing or 'expr' evaluating to an invalid URI), the content of the <prompt> element is played instead. If the prompt resource cannot be played and the content of the <prompt> element is empty, the prompt is not played and no error event is thrown. This behavior follows the specification of the VoiceXML 2.0 <audio> element.

5.4.3 Prompt Resource Fetching Properties

The VoiceXML 2.0 attributes that govern fetching the content associated with a URI also apply to the fetching of <prompt> text. While XHTML+Voice does not add the fetching attributes to the <prompt> element, the fetch of the src URI, or URI resolved from evaluating expr, is governed by the VoiceXML 2.0 "documentfetchhint," "fetchtimeout," "documentmaxage," and "documentmaxstale" properties. Section 6.1 of the VoiceXML 2.0 specification provides details.



Appendices

A Reusable VoiceXML

A VoiceXML form, defined here as an event handler, is more practical if it can be placed in a linked document, separate from the XHTML, as a reusable component. A reusable component allows for easier maintenance, and provides a default behavior that can be used as an application building-block. VoiceXML includes a subdialog construct and its calling convention is close to what is required for a reusable component. The problem is that the caller must know both the subdialog's parameters and the fields included in the ECMAScript object returned to the caller.

It is not within the scope of this profile to attempt to solve the problem of creating authentic reusable components within VoiceXML; this is the domain of the W3C Voice Working Group. Authoring conventions can, however, be suggested which should work in most cases. A VoiceXML handler can be placed in a separate file and linked from within an XHTML+Voice profile document if:

The appendix includes an example of how a subdialog can be reused by following the above authoring conventions.

B Examples

B.1 What You See Is What You Can Say

<?xml version="1.0"?>
<html  xmlns="http://www.w3.org/1999/xhtml" 
       xmlns:vxml="http://www.w3.org/2001/vxml"
       xmlns:ev="http://www.w3.org/2001/xml-events"
       xmlns:xv="http://www.voicexml.org/2002/xhtml+voice"
>
  <head>
    <title>What You See Is What You Can Say</title>
      <!-- first declare the voice handler. -->   
      <vxml:form id="voice_city_hotel">
	  <vxml:field xv:id="field_city" name="field_city">
            <vxml:grammar src="city.jsgf" type="application/x-jsgf"/>
            <vxml:prompt xv:src="#city_label"/>
            <vxml:catch event="help nomatch noinput">
              For example, say Chicago.
            </vxml:catch>
	  </vxml:field>
	  <vxml:field xv:id="field_hotel" name="field_hotel">
            <vxml:grammar src="hotel.jsgf" type="application/x-jsgf"/>
            <vxml:prompt xv:src="#hotel_label"/>
            <vxml:catch event="help nomatch noinput">
              For example, say Hilton.
            </vxml:catch>
            <vxml:filled>
              <vxml:prompt>
		     You selected <vxml:value expr="field_hotel"/>.
	        </vxml:prompt>
            </vxml:filled>
	  </vxml:field>
      </vxml:form>  
      <! -- done voice handler -->
      <!-- declare inputs synchronized with VoiceXML fields -->
      <xv:sync xv:input="city" xv:field="#field_city"/>
      <xv:sync xv:input="hotel" xv:field="#field_hotel"/>
      <xv:cancel id="voice_cancel"/>
  </head>
  <body ev:event="load" ev:handler="#voice_city_hotel">
    <h1>What You See Is What You Can Say</h1>
    <p>This example is a simple application that permits
      the user to enter input using either keyboard or
      stylus, or speak the same information.
    </p>
    <h2>Hotel Picker</h2>
    <p> This voice-enabled application lets you pick a hotel. </p>
    <form id="hotel_query" method="post" action="cgi/hotel.pl">
      <label id="city_label">Please enter city
      <input name="city" type="text"/>
      </label>
      <label id="hotel_label">Please enter hotel
      <input name="hotel" type="text"/>
      </label>
      <input type="submit" value="Submit"/>
      <input type="reset" value="Reset"
		 ev:event="click" xv:handler="#voice_cancel"/>
    </form>
  </body>
</html>

B.2 Mixed-initiative Conversational Interface

<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:vxml="http://www.w3.org/2001/vxml"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xv="http://www.voicexml.org/2002/xhtml+voice"
>
  <head>
    <title>Mixed Initiative Conversational Interface</title>
      <!-- VXML form supporting a mixed-initiative grammar -->
      <vxml:form id="voice_city_hotel">
        <vxml:grammar src="city_hotel.jsgf" type="application/x-jsgf"/>
        <!-- Mixed initiative form begins with initial prompt -->
        <vxml:initial name="start">
	    <vxml:prompt xv:src="#please_choose"/>
          <vxml:help>
            Please say the name of a city and a hotel to make 
            a reservation.
          </vxml:help>
          <!-- If user is silent, reprompt once, then try 
               directed prompts. -->
          <vxml:noinput count="1"><vxml:reprompt/>
          </vxml:noinput>
          <vxml:noinput count="2">
             <vxml:reprompt/>
             <vxml:assign name="start" expr="true"/>
          </vxml:noinput>
        </vxml:initial>
        <vxml:field xv:id="field_city" name="field_city">
          <vxml:grammar src="city.jsgf" type="application/x-jsgf"/>
          <vxml:prompt>Please choose a city.</vxml:prompt>
          <vxml:catch event="help nomatch noinput">
            For example, say Chicago.
          </vxml:catch>
        </vxml:field>
        <vxml:field xv:id="field_hotel" name="field_hotel">
          <vxml:grammar src="hotel.jsgf" type="application/x-jsgf"/>
          <vxml:prompt>Select your hotel.</vxml:prompt>
          <vxml:catch event="help nomatch noinput">
            For example say Hilton.
          </vxml:catch>      
          <vxml:filled>
              <vxml:prompt>
                You selected <vxml:value expr="field_hotel"/>.
	        </vxml:prompt>
          </vxml:filled>
        </vxml:field>
      </vxml:form>
      <!-- done voice handlers -->
      <!-- declare inputs synchronized with VoiceXML fields -->
      <xv:sync xv:input="city" xv:field="#field_city"/>
      <xv:sync xv:input="hotel" xv:field="#field_hotel"/>
      <xv:cancel id="voice_cancel" xv:voice-handler="#voice_city_hotel"/>
  </head>
  <body>
    <h1>Mixed-Initiative Conversational Interface</h1>
    <p>In this example, we demonstrate a mixed-initiative dialog.  By 
       activating a grammar capable of recognizing both cities and
       hotel names, for the entire application, the user can specify
       both hotel and city in a single utterance.  Alternatively,
       the user can fill one field at a time.
    </p>
    <h2>Hotel Picker</h2>
    <p>This voice-enabled application lets you pick a 
       city and a hotel.
    </p>
    <form id="visual_city_hotel" method="post" action="cgi/hotel.pl"
		ev:event="click" ev:handler="#voice_city_hotel" >
      <p id="please_choose">
      Please choose a city and hotel where you wish to stay.
      </p>
      <!-- input name attrib required except for type "text" -->
      <input name="city" type="text"/>
      <input name="hotel" type="text"/>
      <input type="submit" value="Submit" />
      <input type="reset" value="Reset"
		 ev:event="click" ev:handler="#voice_cancel"/>
    </form>
  </body>
</html>

B.3 Speech-Enabled Mail Interface

This email message from the W3C voice browser working group archives has been speech-enabled to allow easy browsing of email on hand-held devices.

<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:vxml="http://www.w3.org/2001/vxml"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xv="http://www.voicexml.org/2002/xhtml+voice"
>
  <head>
    <title>[email protected] from October 2001: preliminary 
           draft for Multimodal Activity 
    </title>
    <meta name="Author" content="Dave Raggett ([email protected])" />
    <meta name="Subject"
      content="preliminary draft for W3C multimodal activity" />
    <link rel="Stylesheet"
      href="http://www.w3.org/StyleSheets/Mail/member-message"/>
    <script language="javascript">
    // define array holding command words -> activate-id map.
    var commands = new Array();
    commands.push("__next_message");
    commands.push("__prev_message");
    commands.push("__sort_by_date");
    commands.push("__sort_by_thread");
    commands.push("__sort_by_subject");
    commands.push("__sort_by_author");
    commands.push("__more_from_this_list");
    commands.push("__other_w3c_lists");
    commands.push("__respond_to_this_message");
    commands.push("__mail_new_topic");
    commands.push("__reply_to");
    //activate takes a command word, looks it up in the commands
    // map, and activates the link.
    function activate (command) { 
            var length = commands.length;
            for (var i=0;i<length;i=i++) {
                if (command == commands[i]) {
                    document.getElementById(commands[i]).click();                 
                    break;  
                }       
            }
        }
    }
    </script>
    <script ev:observer="command-and-control" ev:event="vxmldone" 
            declare="declare">
        activate(application.lastresult$[0].interpretation);
    </script>
    <vxml:form id="command-and-control">
        <!-- your word is my command. -->
        <vxml:field name="word">
            <vxml:grammar jsgf="mail.jsgf"/>
            <vxml:catch event="help nomatch">
            This mail reader is speech-enabled. You can
            perform available actions via speech input.
          </vxml:catch>
      </vxml:field>
    </vxml:form>
    </head>
    <body ev:event="load" ev:handler="#command-and-control">
    <h1>preliminary draft for W3C multimodal activity</h1>
    <strong>From:</strong> Dave Raggett (
<a id="__reply_to"
href="mailto:[email protected]?Subject=Re:%20preliminary%20draft%20for\
%20W3C%20multimodal%20activity&In-Reply-To=<Pine.WNT.4.10.10\
110301232270.-1031403-100000@hazel>&References=<Pine.WNT.\
4.10.10110301232270.-1031403-100000@hazel>">
      <em>[email protected]</em>
</a>)<br />
    <strong>Date:</strong> Tue, Oct 30 2001 
    <p><!-- next="start" --></p>
    <ul class="noindent">
      <li><strong>Next message:</strong>
          <a id="__next_message" href="0093.html">
 [email protected]: "Re: [dialog] <record>'s dest attribute"
          </a>
      </li>
    </ul>
    <ul>
      <li><strong>Previous message:</strong> 
          <a id="__previous_message" href="0091.html">
 Harish Varanasi: "RE: [ dialog ] <record>'s dest attribute"
          </a> 
        <!-- nextthread="start" -->
        <!-- reply="end" -->
      </li>
      <li><strong>Messages sorted by:</strong> 
          <a id="__sort_by_date" href="index.html#92">
              [ date ]</a>
          <a id="__sort_by_thread" href="thread.html#92">
              [ thread ]</a>
          <a id="__sort_by_subject" href="subject.html#92">
              [ subject ]</a> 
          <a id="__sort_by_author" href="author.html#92">
		  [ author ]</a>
      </li>
      <li><strong>Other mail archives:</strong>
        <a id="__more_from_this_list"  href="../">
            [ this mailing list ]</a>
        <a id="__other_w3c_lists"  href="../../">
            [ other W3C mailing lists ]</a>
      </li>
      <li><strong>Mail actions:</strong>
 <a id="__respond_to_this_message"
    href="mailto:[email protected]?Subject=Re:%20preliminary\
%20draft%20for%20W3C%20multimodal%20activity&In-Reply-To=\
<Pine.WNT.4.10.10110301232270.-1031403-100000@hazel>&\
References=<Pine.WNT.4.10.10110301232270.-1031403-100000@hazel>">
          [ respond to this message ]</a>
 <a id="__mail_new_topic" href="mailto:[email protected]">
     [ mail a new topic ]</a></li>
    </ul>
    <hr noshade="noshade" />
    <p><!-- body="start" --></p>
    <pre>
    Message body was here.
    </pre>    
    <p><!-- body="end" --></p>
    <hr noshade="noshade" />
    <ul><!-- next="start" -->
     </ul>
    <!-- trailer="footer" -->
  </body>
</html>

B.4 Reusable VoiceXML Subdialogs

A flight query is processed with two reusable VoiceXML subdialogs. One subdialog processes the departure city or airport, the other the departure date.

<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:vxml="http://www.w3.org/2001/vxml"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xv="http://www.voicexml.org/2002/xhtml+voice" >
  <head>
    <title>Flight Query</title>
    <script src="cityorairport.es">
      var objCityOrAirport = new CityOrAirport();
    </script>
    <script src="dateinfo.es">
      <var objDateInfo = new DateInfo();
    </script>
    <vxml:form id="voice_city_from">
      <vxml:subdialog name="cityorairport"
                     src="cityorairport.vxml#cityorairportform">
        <vxml:param name="paramSubdialogObj" expr="objCityOrAirport"/>
        <vxml:param name="paramPromptQuestion"
              expr="'What city or airport are you departing from?'"/>
        <vxml:filled>
          <vxml:prompt>
          You are departing from
			<value expr="cityorairport.returnCityOrAirport"/>.
          </vxml:prompt>
	    <vxml:assign name="document.from"
			     expr="cityorairport.returnCityOrAirport"/>
        </vxml:filled>
      </vxml:subdialog>
    </vxml:form>
    <vxml:form id="voice_date_from">
      <vxml:subdialog name="dateinfo" src="dateinfo.vxml#dateform">
        <vxml:param name="paramSubdialogObj" expr="objDateInfo"/>
        <vxml:param name="paramPromptQuestion"
              expr="'What day, month, and year are you leaving?'"/>
        <vxml:filled>
          <vxml:prompt>
            You are departing on
                    <value expr="dateinfo.returnDateInfo"/>.
          </vxml:prompt>
	       <vxml:assign name="document.fromDate"
		           expr="dateinfo.returnDateInfo"/>
          </vxml:filled>
        </vxml:subdialog>
    </vxml:form>
    <xv:cancel id="voice_cancel"/>
  </head>
  <body>
    <h1>Multimodal Flight Query</h1>
    <form method="post" action="/servlet/flightServlet">
      <table border="0">
        <tr>
          <td width="15%">
          <label for="from">Leaving From:</label>
          </td>
          <td colspan="2">
            <input type="text" id="from" size="20" 
                   ev:event="click" 
                   ev:handler="#voice_city_from" />
           </td>
        </tr>
        <tr>
          <td width="15%">
            <label for="fromDate">Travel Date:</label>
          </td>
          <td width="35%">
            <input type="text" id="fromDate" size="20"
                   ev:event="click"
                   ev:handler="voice_date_from"/>
          </td>
          <td width="50%">
            <div class="c1"><label>Time of Day:</label>
            <br />
              <table width="100%" border="0"
                               summary="leave am or pm">
                <tr>
                  <td align="left">
                    <input type="checkbox" id="departam"
                           value="checkbox"/> 
                    <label for="departam">am</label> </td>
                  <td align="left">
                    <input type="checkbox" id="departpm"
                           value="checkbox"/> 
                    <label for="departpm">pm</label></td>
                </tr>
              </table>
            </div>
          </td>
        </tr>
      </table>
      <br />
      <table align="center">
        <tr>
          <td width="80%">
            <input type="submit" value="Submit"/>
          </td>
          <td>
            <input type="reset" value="Reset"
		   ev:event="click" ev:handler="#voice_cancel"/>
          </td>
        </tr>
      </table>
    </form>
  </body>
</html>

C FIA for XHTML+Voice

An XHTML+Voice voice handler is processed according to the VoiceXML 2.0 form interpretation algorithm (FIA). Because many of the VoiceXML elements, as well as forms with document grammar scope, are not supported, XHTML+Voice simplifies the FIA. Below is the FIA pseudo-code taken from Appendix C of [VoiceXML 2.0]. Comments are placed above the sections that are not supported and crossed-out. For example, the comment "No script tag" is above the crossed-out section that processes the VoiceXML 2.0 <script> element.

At any time during the running of the FIA a cancel message from the visual browser may have to be processed. This will terminate the FIA. The other external message is sync for declarative synchronization of visual and speech inputs. Sync modifies the selection phase of the FIA as follows. The guard condition of the field associated with the sync is cleared and the field is selected. If the sync carries with it data entered from XHTML during processing of the FIA, then sync will update the field with the data and set its guard condition. Finally, sync returns the utterance collected in the field to the visual browser. The field contents is returned after the FIA's process stage. This allows the field contents to be updated by the <filled> processing before the XHTML input is set by sync.

//
// Initialization Phase
//
foreach ( <var>, <script> and form item, in document order )
{
   if ( the element is a <var> )
     Declare the variable, initializing it to the value of
     the "expr" attribute, if any, or else to undefined.
   // No script tag
else if ( the element is a <script> ) No script tag Evaluate the contents of the script if inlined or else from the location specified by the "src" attribute.
else if ( the element is a form item ) Create a variable from the "name" attribute, if any, or else generate an internal name. Assign to this variable the value of the "expr" attribute, if any, or else undefined. foreach ( input item and <initial> element ) { Declare a prompt counter and set it to 1. } } // No document-level grammars
if ( user entered this form by speaking to its grammar while in a different form) { Enter the main loop below, but start in the process phase, not the select phase: we already have a collection to process. }
// // Main Loop: select next form item and execute it. // while ( true ) { // // Select Phase: choose a form item to visit. // // No goto
if ( the last main loop iteration ended with a <goto nextitem> ) Select that next form item.
if there is a sync event, the form item associated with the sync is selected after clearing its guard condition else if (there is a form item with an unsatisfied guard condition ) Select the first such form item in document order. else
Do an <exit>
return -- the form is full and specified no transition. // // Collect Phase: execute the selected form item. // // Queue up prompts for the form item. unless ( the last loop iteration ended with a catch that had no <reprompt>, // cannot change active dialogs
and the active dialog was not changed
) { Select the appropriate prompts for an input item or <initial>. Queue the selected prompts for play prior to the next collect operation. Increment an input item's or <initial>'s prompt counter. } // Activate grammars for the form item. if ( the form item is modal ) Set the active grammar set to the form item grammars, if any. (Note that some form items, e.g. <block>, cannot have any grammars). else Set the active grammar set to the form item grammars and any grammars scoped to the form,
the current document, and the application root document.
// Execute the form item. if ( a <field> was selected ) Collect an utterance or an event from the user. else if ( a <record> was chosen ) Collect an utterance (with a name/value pair for the recorded bytes) or event from the user. // no <object>
else if ( an <object> was chosen ) Execute the object, setting the <object>'s form item variable to the returned ECMAScript value.
else if ( a <subdialog> was chosen ) Execute the subdialog, setting the <subdialog>'s form item variable to the returned ECMAScript value. // no <transfer>
else if ( a <transfer> was chosen ) Do the transfer, and (if wait is true) set the <transfer> form item variable to the returned result status indicator.
else if ( an <initial> was chosen ) Collect an utterance or an event from the user. else if ( a <block> was chosen ) { Set the block's form item variable to a defined value. Execute the block's executable context. } // If cancel received from collection phase, check // if cancel due to an external sync event, otherwise // exit the FIA. // If the sync event is received due to blur of the // synchronized HTML input, set the guard condition // and update the field with the user's input. // If sync event received skip process phase. // // Process Phase: process the resulting utterance or event. // Assign the utterance and other information about the last recognition to application.lastresult$. // Must have an utterance // no link except supplied by browser for command & control
if ( the utterance matched a grammar belonging to a <link> ) If the link specifies an "next" or "expr" attribute, transition to that location. Else if the link specifies an "event" or "eventexpr" attribute, generate that event.
// no choice
else if ( the utterance matched a grammar belonging to a <choice> ) If the choice specifies an "next" or "expr" attribute, transition to that location. Else if the choice specifies an "event" or "eventexpr" attribute, generate that event.
// no grammar outside the current <form> except command & control if ( the utterance matched a grammar from outside the current <form> ) { Transition to the command & control handler for the utterance. }
else if ( the utterance matched a grammar from outside the current <form> or <menu> ) { Transition to that <form> or <menu>, carrying the utterance to the new FIA. }
// Process an utterance spoken to a grammar from this form. // First copy utterance result property values into corresponding // form item variables. Clear all "just_filled" flags. if ( the grammar is scoped to the field-level ) { // This grammar must be enclosed in an input item. The input item // has an associated ECMAScript variable (referred to here as the input // item variable) and slot name. if ( the result is not a structure ) Copy the result into the input item variable. elseif ( a top-level property in the result matches the slot name or the slot name is a dot-separated path matching a subproperty in the result ) Copy the value of that property into the input item variable. else Copy the entire result into the input item variable Set this input item's "just_filled" flag. } else { foreach ( property in the user's utterance ) { if ( the property matches an input item's slot name ) { Copy the value of that property into the input item's form item variable. Set the input item's "just_filled" flag. } } } // Set all <initial> form item variables if any input items are filled. if ( any input item variable is set as a result of the user utterance ) Set all <initial> form item variables to true. // Next execute any <filled> actions triggered by this utterance. foreach ( <filled> action in document order ) { // Determine the input item variables the <filled> applies to. N = the <filled>'s "namelist" attribute. if ( N equals "" ) { if ( the <filled> is a child of an input item ) N = the input item's form item variable name. else if ( the <filled> is a child of a form ) N = the form item variable names of all the input items in that form. } // Is the <filled> triggered? if ( any input item variable in the set N was "just_filled" AND ( the <filled> mode is "all" AND all variables in N are filled OR the <filled> mode is "any" AND any variables in N are filled) ) Execute the <filled> action. If an event is thrown during the execution of a <filledgt;, event handler selection starts in the scope of the <filled>, which could be an input item or the form itself. } // If no input item is filled, just continue. For all fields synchronized with HTML input controls, update the input controls with the contents of the fields. // continue }

D DTD

This section defines the DTD used to define the XHTML+Voice 1.2 integration profile.

D.1 xhtml+voice12.dtd

The individual modules making up the DTD for the XHTML+Voice 1.2 profile along with the top-level driver file are packaged together and available at xhtml-voice12-DTD.zip. Although the use of the DTD in place of the SCHEMA requires the elements and attributes specified by both [Speech Grammars] and [SSML 1.0] to be placed within their respective namespaces, this DTD informally puts these elements in the VoiceXML 2.0 namespace.

E Schema

This section is normative.

This section defines the formal XML Schema used to define the XHTML+Voice 1.2 profile. This section is normative.

E.1 xhtml+voice12.xsd

The individual modules making up the SCHEMA for the XHTML+Voice 1.2 profile along with the top-level driver file are packaged together and available at xhtml-voice12-SCHEMA.zip.

F VoiceXML Container for the XHTML+Voice Subset

This section defines the DTD used to formally define a VoiceXML container for the XHTML+Voice subset of VoiceXML 2.0. The container stores VoiceXML forms that can be run as external voice handlers by XHTML+Voice 1.2 applications. The container is one possible profile of VoiceXML 2.0 that can be defined as a result of VoiceXML 2.0 modularization. The container includes all the VoiceXML 2.0 modules supported by XHTML+Voice 1.2, the XHTML+Voice 1.2 attribute extensions to VoiceXML 2.0, and the VoiceXML 2.0 root module. The root module adds the top-level <vxml> element and the <meta> and <metadata> elements for specifying meta information.

F.1 vxml20-xvsubset.xsd

The individual modules making up the SCHEMA for the VoiceXML 2.0 Container for the XHTML+Voice subset along with the top-level driver file are packaged together and available at vxml20-xvsubset-SCHEMA.zip.

G Multimodal Auto Fill

Multimodal auto fill assists an XHTML+Voice application running on a PDA or cellphone that requires the submission of form input data. By extending the auto fill capabilities of a visual browser with voice interaction the user can easily add name, address, and other personal data to form input fields.

Auto fill automatically completes the form input fields for the user with the contents of the browser's user preferences dialog; the name of each user preferences entry is matched to a form input field. The following table shows sample entries for a user preferences dialog.

Table 9: Sample User Preferences
Entry Sample Value
Full Name Earl Sandwich
Email Address [email protected]
Phone Number 921-555-2329
Address Line 1 22 Dandelion Way
Address Line 2  
City Saturn
State/province FL
Zip/postal code 33872
Country United States

A visual browser uses the content of the XHTML label element, or field names defined in the ECML (Electronic Commerce Modeling Language) standard, defined in [RFC3106], or some other heuristic, to match a form input field with a user preferences entry. Once the visual browser matches a form input field with a preferences entry, multimodal auto fill adds a grammar representing the preferences entry to an active VoiceXML form. This grammar applies to the VoiceXML field that is synchronized with the matched XHTML input. The input is synchronized with the VoiceXML field via the XHTML+Voice <sync> element.

The following example has XHTML input fields for name, address, city, and phone number. The visual browser matches these inputs with the corresponding entries stored with the user preferences.

<?xml version="1.0" encoding="iso-8859-1" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:vxml="http://www.w3.org/2001/vxml"
      xmlns:xv="http://www.voicexml.org/2002/xhtml+voice"
      xml:lang="en_US" >
  <head><title>Multimodal Delivery System</title>
    <vxml:form id="delivery_form">
      <vxml:block>
	Please enter your name, address and phone number.
      </vxml:block>
      <vxml:field name="voice_name" xv:id="voice_name">
        <vxml:grammar src="names.jsgf"/>
	<vxml:prompt>
	  Please enter your name.
	</vxml:prompt>
	<vxml:catch event="help nomatch noinput">
	  Please enter your name.
	</vxml:catch>
      </vxml:field>
      <vxml:field name="voice_address" xv:id="voice_address">
	<vxml:grammar src="addresses.jsgf"/>
	<vxml:prompt>
	  Please enter your street address.
	</vxml:prompt>
	<vxml:catch event="help nomatch noinput">
	  Plese enter your street address.
	</vxml:catch>
      </vxml:field>
      <vxml:field name="voice_city" xv:id="voice_city">
	<vxml:grammar src="cities.jsgf"/>
	<vxml:prompt>
	  Please enter your city.
	</vxml:prompt>
	<vxml:catch event="help nomatch noinput">
	  Please enter your city.
	</vxml:catch>
      </vxml:field>
      <vxml:field name="voice_phoneno" xv:id="voice_phoneno" type="digits">
	<vxml:grammar src="phonenos.jsgf"/>
	<vxml:prompt>
	  Please enter your phone number
	</vxml:prompt>
	<vxml:catch event="help nomatch noinput">
	  Please enter your phone number.
	</vxml:catch>
      </vxml:field>
      <vxml:field name="confirm_delivery"
            xv:id="confirm_delivery" type="boolean">
        <vxml:prompt>
	  Is the delivery information correct?
	</vxml:prompt>
	<vxml:filled>
	  <vxml:if cond="confirm_delivery == true">
	    Thank you.  
	    <vxml:return/>
	  </vxml:if>
	</vxml:filled>
      </vxml:field>
    </vxml:form>
    <xv:sync xv:input="full_name" xv:field="#voice_name"/>
    <xv:sync xv:input="address" xv:field="#voice_address"/>
    <xv:sync xv:input="city" xv:field="#voice_city"/>
    <xv:sync xv:input="phoneno" xv:field="#voice_phoneno"/>
    <xv:sync xv:input="submitButton" xv:field="#confirm_delivery"/>
  </head>
  <body ev:event="load" ev:handler="#delivery_form">
    <form action="">
      <table border="0" width="70%" cellpadding="0" cellspacing="10">
        <tr><td><label for="#full_name"><b>Name:</b></label> <br/>
          <input type="text" name="full_name" id="full_name"/></td></tr>
	<tr><td><label for="#address"><b>Street Address:</b></label><br/>
          <input type="text" name="address" id="address"/></td></tr>
        <tr><td><label for="#city"><b>City:</b></label><br/>
	  <select name="city" id="city">
            <option value="daytona">Daytona</option>
            <option value="boynton">Boynton Beach</option>
            <option value="fort lauderdale">Fort Lauderdale</option>
            <option value="saturn">Saturn</option>
	    <option value="miami">Miami</option>
	    <option value="orlando">Orlando</option>
            <option value="westpalm">West Palm Beach</option>
	  </select>
        </td></tr>
	<tr><td><label for="#telephone"><b>Phone:</b></label><br/>
	  <input type="text" name="phoneno" id="telephone"/></td></tr>
	<tr><td></td></tr>
	<tr><td>
          <input type="submit" name="submitButton" value="Submit Delivery"/></td>
        </tr>
      </table>
    </form>
  </body>
</html>

Multimodal auto fill adds the following eight grammars to the active VoiceXML form. For this example all the grammars are in JSGF 1.0 format.

#JSGF V1.0;
	grammar my_full_name;
        public <my_full_name> = [my] name {$="Earl Sandwich"};
#JSGF V1.0;
        grammar my_email_address;
	public <my_email_address> = [my] e-mail [address] {$="[email protected]"};
#JSGF V1.0;
	grammar my_phone_number;
	public <my_phone_number> = [my] phone [number] {$="921-555-2329"};
#JSGF V1.0;
	grammar my_address_line_1;
	public <my_address_line_1> = [my] address [line 1] {$="22 Dandelion Way"};
#JSGF V1.0;
	grammar my_city;
	public <my_city> = [my] city {$="Saturn"};
#JSGF V1.0;
	grammar my_state_province;
	public <my_state_province> = [my] (state | province) {$="FL"};
#JSGF V1.0;
	grammar my_zip_postal;
	public <my_zip_postal> = [my] (zip | postal) [code] {$="33872"};
#JSGF V1.0;
	grammar my_country;
	public <my_country> = [my] country {$="United States"};

Each grammar is added to the grammars for the VoiceXML field that is synchronized via the <sync> element with the XHTML input that matched the user preferences entry. Semantic interpretation is used to set the field to the preferences value when the entry name is recognized. The prefix "my_" is used with the grammars above to prevent a collision with the grammars in the application.

H Changes from XHTML+Voice 1.1

The following is a summary of the differences between XHTML+Voice 1.2 and XHTML+Voice 1.1 [XHTML+Voice 1.1].

H.1 Modified Elements

H.2 Clarifications

  • The <sync> element does not synchronize a VoiceXML <field> element with a JavaScript variable (Sync).

  • An existing XHTML <input> value does not update its synchronized VoiceXML <field> when the VoiceXML form is activated (Sync).

  • For an XML Events event emitted from a VoiceXML form, the target of the event is the XHTML element that activated the VoiceXML form (XHTML+Voice Event Propagation).

  • JavaScript can activate a voice handler by dispatching a DOMActivate event against the voice handler's id attribute. The target of a VoiceXML event generated by the VoiceXML form is the VoiceXML form element itself (DOMActivate).

  • A set of standard grammars is used with the <sync> element for synchronizing with the different types of XHTML controls (Standard Grammars for XHTML Controls).

  • The VoiceXML 2.0 <enumerate> element and the <option> element belong in their own modules (Modularization of VoiceXML 2.0).

  • The VoiceXML 2.0 <metadata> element should be included with the XHTML+Voice profile as either a SSML or SRGS element (i.e., below the <prompt> and <grammar> elements, respectively) (Modularization of VoiceXML 2.0).

  • XHTML+Voice processing ignores all VoiceXML 2.0 attributes it does not support when they are encountered (VoiceXML Scope within XHTML+Voice).

  • The VoiceXML <return> element can be used to end a running voice dialog and return to the XHTML container (Returning from a VoiceXML Form).

  • If the prompt resource is in an external file, the rules for styling the resource apply only to the retrieved XML element and its children (Styling External Prompt Resources).

  • If the prompt resource cannot be played, the content of the <prompt> element is played instead. If the prompt resource cannot be played and the content is empty, the prompt is not played and no error is thrown (Invalid Prompt Resource).

  • The VoiceXML 2.0 properties "documentfetchhint," "fetchtimeout," "documentmaxage," and "documentmaxstale" that govern fetching the content associated with a URI also apply to the fetching of prompt text (Prompt Resource Fetching Properties).

  • XHTML+Voice puts the VoiceXML application scope below the shared global scope (Accessing XHTML from a Speech Dialog).

  • Sync returns the utterance collected in the field to the visual browser after the FIA's process stage. This allows the field contents to be updated by the <filled> processing before the XHTML input is set by sync (FIA for XHTML+Voice).

H.3 Miscellaneous

I References

I.1 Normative References

XHTML Basic
XHTML Basic , 19 December 2000, Mark Baker, Masayasu Ishikawa, Shinichi Matsui, Peter Stark, Ted Wugofski, Toshihiko Yamakami
CSS2
Cascading Style Sheets, level 2 (CSS2) Specification, Bert Bos, Håkon Wium Lie, Chris Lilley, Ian Jacobs, 1998. W3C Recommendation available at: http://www.w3.org/TR/REC-CSS2/.
DOM2 Events
Document Object Model (DOM) Level 2 Events Specification, Tom Pixley, 2000. W3C Recommendation available at: http://www.w3.org/TR/DOM-Level-2-Events/.
HTML 4.01
HTML 4.01 Specification, Dave Raggett, Arnaud le Hors, Ian Jacobs, 1999. W3C Recommendation available at: http://www.w3.org/TR/html4/.
RFC 2396
RFC 2396: Uniform Resource Identifiers (URI): Generic Syntax., Tim Berners-Lee, et. al., 1998. Available at: http://www.ietf.org/rfc/rfc2396.txt.
Semantic Interpretation
Semantic Interpretation for Speech Recognition , Luc Van Tichelen. W3C Working Draft, April, 2003 available at: http://www.w3.org/TR/semantic-interpretation/.
Speech Grammars
Speech Recognition Grammar Specification Version 1.0, Andrew Hunt and Scott McGlashan. W3C Recommendation, March, 2004 available at: http://www.w3.org/TR/speech-grammar/.
SSML 1.0
Speech Synthesis Markup Language Specification, Mark Walker, Dan Burnett, and Andrew Hunt. W3C Candidate Working Draft, December, 2003 available at: http://www.w3.org/TR/speech-synthesis/.
VoiceXML 2.0
Voice Extensible Markup Language (VoiceXML) , Scott McGlashan et al, W3C Recommendation, March, 2004 available at: http://www.w3.org/tr/voicexml20/.
XHTML 1.0
XHTML 1.0: The Extensible HyperText Markup Language - A Reformulation of HTML 4 in XML 1.0, Steven Pemberton, et. al, 2000. W3C Recommendation available at: http://www.w3.org/TR/xhtml1/.
XHTML 1.1
XHTML 1.1 - Module-based XHTML Murray Altheim, Shane McCarron available at: http://www.w3.org/TR/xhtml11/.
XHTML+Voice 1.0
XHTML+Voice Profile 1.0, Jonny Axelsson, et. al., December 21, 2001. Available at: http://www.w3.org/TR/xhtml+voice.
XHTML+Voice 1.1
XHTML+Voice Profile 1.1, Jonny Axelsson, et. al., January 28, 2003. Available at: http://www-3.ibm.com/software/pervasive/multimodal/x+v/11/spec.htm.
XHTML Modularization
Modularization of XHTML Murray Altheim, Frank Boumphrey, et. al., available at: http://www.w3.org/TR/xhtml-modularization/.
XML 1.0
Extensible Markup Language (XML) 1.0 (Second Edition), Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, 2000. W3C Recommendation: available at: http://www.w3.org/TR/REC-xml.
XML Events
XML Events - An events syntax for XML, Steven Pemberton, T. V. Raman and Shane P McCarron, October 14, 2003. W3C Recommendation available at: http://www.w3.org/TR/xml-events/.
XML Names
Namespaces in XML, Tim Bray, Dave Hollander, Andrew Layman, 1999. W3C Recommendation available at: http://www.w3.org/TR/REC-xml-names/.
XSchema-1
XML Schema Part 1: Structures, Henry S. Thompson, David Beech, Murray Maloney, Noah Mendelsohn, 2001. W3C Recommendation available at: http://www.w3.org/TR/xmlschema-1/.
XSchema-2
XML Schema Part 2: Datatypes, Paul V. Biron, Ashok Malhotra, 2001. W3C Recommendation available at: http://www.w3.org/TR/xmlschema-2/.

I.2 Informative References

ECMA 262
ECMA-262: ECMAScript Language Specification, European Computer Manufacturers' Association (ECMA), 1999. Available at ftp://ftp.ecma.ch/ecma-st/Ecma-262.pdf.
RFC 2141
RFC 2141: URN Syntax, R. Moats, 1997. Available at: http://www.ietf.org/rfc/rfc2141.txt.
XForms
XForms 1.0 , Micah Dubinko, Josef Dietl, Roland Merrick,Dave Raggett, T. V. Raman, Linda Bucsay Welsh 2001. W3C Candidate Recommendation available at: http://www.w3.org/TR/xforms/.
XSchema-0
XML Schema Part 0: Primer, David C. Fallside, 2001. W3C Recommendation available at: http://www.w3.org/TR/xmlschema-0/.
XSLT
XSL Transformations (XSLT) Version 1.0, James Clark, 1999. W3C Recommendation available at: http://www.w3.org/TR/xslt.