Excerpt: Early Adopter VoiceXML: VoiceXML with XSLT (HTML and WML)
<myrubberbands export_type="single">The thing we are most interested is a customer record, because that will be the set of data needed to generate the voice interface for querying order status. Since we might have more than one customer in a file, each individual <customer> and their associated order history will be contained by a <customer_record> element. Note that the time stamps are in XSL's standard format, and won't translate easily for rendering by a TTS engine. The <customer_record> element that starts here is very lengthy, and is not closed until the associated addresses and order history that follows have been given.
<customer_record> <customer id="1"> <firstname>John</firstname> <middle>Quincy</middle> <lastname>Public</lastname> <username_or_email>firstname.lastname@example.org</username_or_email> <password_or_pin>bar</password_or_pin> <date_joined>2001-05-18T16:17:15</date_joined> <date_lastchg>2001-05-18T16:17:15</date_lastchg> </customer>As shown in the database schema, a customer can have one or more addresses. The XML representation should preserve the foreign key relationship with the customer table, and this relationship should not be dependent on the position of the elements. In this case, for example, both the customer profile and all associated addresses are nested within the <customer_record> tag. This is why all of the <customer_address> elements carry the customer_id attribute inside: it mirrors the relationship between the customer and customer_address tables in the database schema.
In this case, the database schema allows the customer_address table to store real physical addresses like billing and shipping addresses, or e-mail address for alternate methods of customer contact. Hence, the <customer_address> element can contain the optional <email> element.
<customer_address address_type="Ship To Address" customer_id="1"> <address1>4321 La Place Ct</address1> <address2>Ste 306</address2> <city>Carlsbad</city> <state_or_prov>CA</state_or_prov> <postalcode>92008</postalcode> <email></email> <phone>7605551212</phone> </customer_address>Since the main objective of the voice application is to allow the user access to their order history and status information, it makes sense to include the history inside the <customer_record> scope. In this case, because we will need to enunciate the order time, and because we'd rather not use XSL's limited text processing capabilities, we'll add the attribute sayas to the <order_date> element. This provides a pronunciation that can be used with the VoiceXML <sayas> tag for TTS. However, the desired pronunciation of the date and time cannot be derived from the database alone, as addressed in the section Generating MyRubberbandsML.
Join us next week for more of Chapter 7 from Early Adopter VoiceXML.
Page 5 of 5