Presentation Technologies

Team-Fly    

 
XML, Web Services, and the Data Revolution
By Frank  P.  Coyle
Table of Contents
Chapter 2.   The XML Technology Family


Representing data with XML opens up new possibilities for transport and distribution. XML presentation technologies provide a modular way to deliver and display content to a variety of devices. Here we examine some technologies for display, including CSS, XSL, Xforms, and VoiceXML.

CSS

CSS is used to control document display.

Cascading style sheets is an XML-supporting technology for adding style display properties such as fonts, colors, or spacing to Web documents. CSS origins may be traced to the SGML world, which used a style sheet technology called DSSSL to control the display of SGML documents. Style sheet technology is important because it lets developers separate presentation from content, which greatly enhances software's longevity.

As Figure 2.10 shows, a style sheet tells a browser or other display engine how to display content. Each rule is made up of a selector ”typically an element name such as an HTML heading ( H1 ) or paragraph ( P ), or a user -defined XML element ( Book ) ”and the style to be applied to the selector. The CSS specification defines numerous properties ( color , font style, point size , and so on) that may be defined for an element. Each property takes a value which describes how the selector should be presented.

Figure 2.10. HTML or XML may be delivered to a browser with CSS, which controls how data is presented on the screen.

graphics/02fig10.jpg

Style rules have the following syntax.

 selector { property: value } 

Multiple style declarations for a single selector are separated by a semicolon. The following code segment shows how a CSS element can be added to an HTML or XML document to define the color and font size properties for TITLE and AUTHOR elements:

 <STYLE TYPE="text/css"> TITLE { font-size: x-large; color: red } AUTHOR { font-size: large; color: blue } </STYLE> 

This style sheet tells the browser to show the content of TITLE elements in an extra-large red font, and to show the content of AUTHOR elements in a large blue font. Although CSS technology was designed to allow finer control of how HTML is displayed, CSS makes no assumptions about the tags' names , which is why cascading style sheets can be used just as easily with XML as with HTML.

CSS is a W3C Recommendation.

Because style sheet technology is important for the Web design industry, the CSS specification has undergone significant evolution. The CSS1 specification, which defines all properties and values that can be applied to a Web document, received its W3C Recommendation status in December 1996. It describes the CSS language as well as a simple visual formatting model. CSS2, which itself became a W3C Recommendation in May 1998, builds on CSS1 and adds support for style sheets for specific media such as printers and audio devices, as well as downloadable fonts, element positioning, and tables.

CSS has limitations for complex displays.

However, there are two drawbacks with CSS that should be noted. The first is that CSS describes only those tags that are to be treated in a special way; the browser decides how to display elements that the style sheet says nothing about. While this typically works fine for HTML, with XML, where it may be desirable not to display certain data, CSS does not help. The second drawback is that with CSS technology it is up to the browser to implement CSS correctly, and some implementations may not always be consistent.

XSL

XSL 1.0 is a W3C Recommendation that provides users with the ability to describe how XML data and documents are to be formatted. XSL does this by defining "formatting objects," such as footnotes, headers, or columns .

XSL began as an effort to provide a better CSS.

The XSL initiative began as an effort to develop a styling technology more suited to the needs of XML than CSS. However, in pulling together a Working Group to define XSL, something interesting happened . The Working Group realized that the kind of styling per formed by technologies such as CSS was only one instance of a more general "transformation" process of taking an XML document and turning it into another kind of document. After much deliberation the XSL Working Group split into two subgroups, one focused on trying to build a better display-oriented style sheet technology and a second group trying to define a transformation language that could be used to transform XML into a variety of target languages including HTML, other dialects of XML, or any text document, including a program. The result of this effort was XSLT, which achieved W3C Recommendation status in November 1999 and which we discuss in the next section of this chapter.

XSL is based on applying rules or templates to an XML document.

An XSL style sheet is basically a series of pattern-action rules and looks like an XML document with a mixture of two kinds of elements: those defined by XSL and those defined by the object language. The patterns are similar to CSS's selectors, but the action part may create an arbitrary number of "objects." The action part of the rule is called the "template" in XSL, and a template and a pattern together are referred to as a "template rule."

The result of applying all matching patterns to a document recursively is a tree of objects, which is then interpreted top-down according to the definition of each object. For example, if they are HTML objects, an HTML document will be generated; if they are XML objects, XML will be the result.

CSS Compared to XSL

The fact that the W3C has started developing XSL in addition to CSS has caused some confusion. Why develop a second style sheet language when implementers haven't even finished the first one? The W3C has answered this question with the information in Table 2.1.

In practice, both CSS and XSL may be used in conjunction with each other. Figure 2.11 illustrates some of the different options for using CSS and XSL to create displays based on HTML or XML. The general principle is that if the document is to be simply rendered and not transformed in any way through the addition or deletion of items, then CSS is the more straightforward approach.

Figure 2.11. Options for using CSS and XSLT with XML and HTML. [2]

graphics/02fig11.jpg

[2] http://www.w3.org/Style/CSS-vs-XSL. Copyright 2001 World Wide Web Consortium (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/. Updated July 1999.

XForms

Forms are widely used in all aspects of e-commerce.

Soon after HTML began to be used to deliver content from Web sites to browsers, it became apparent that it was also necessary to push data from browsers to servers. The result was HTML forms. Since their introduction in 1993, forms have become a critical aspect of Web-based e-commerce. However, existing mechanisms for form data capture are limited, especially when complex data spanning multipart forms must be collected and complex logic is required.

Table 2.1. Comparison of CSS and XSL
  CSS XSL
Can be used with HTML? yes no
Can be used with XML? yes yes
Transformation language? no yes
Syntax CSS XML
SOURCE: http://www.w3.org/Style/. Copyright 2001 World Wide Web Consortium (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/. Last updated November 2001.

XForms delivers XML.

XForms is an XML approach that overcomes the limitations of HTML forms. XForms is a GUI toolkit for creating user interfaces and delivering the results in XML. Because XForms separates what the form does from how it looks, XForms can work with a variety of standard or proprietary user interfaces, providing a standard set of visual controls that replaces the primitive forms controls in HTML and XHTML. Included in XForms are a variety of buttons , scrollbars, and menus integrated into a single execution model that generates XML form data as output.

Figure 2.12 illustrates how a single device-independent XML form definition, called the XForms Model, has the capability to work with a variety of standard or proprietary user interfaces. For example, the Voice Browser Working Group is looking at developing voice-based user interface components for XForms.

Figure 2.12. XForms provides a standard way to collect form data through a variety of device interfaces.

graphics/02fig12.jpg

There are currently several XForms implementations:

  • X-Smiles is a Java-based XML browser from Helsinki University of Technology. It implements a large part of XForms and uses XForms together with XSL-FO on the user interface side. It also supports XSLT, Synchronized Multimedia Integration Language 1.0, and Scalable Vector Graphics.

  • Mozquito XForms Preview is an XML-based Web development software that implements XForms and gives current Web browsers the ability to send, receive, and process XML data easily and effectively. It reads and writes XML instances without the need for XSL.

XHTML

XHTML brings HTML into conformance with XML.

XHTML is an effort by the W3C to replace HTML with a more flexible approach to displaying Web content. XHTML differs from HTML in that it is based on XML, not SGML. Thus, XHTML conforms to the XML 1.0 Recommendation. The long- term goal of the XHTML spec is that XHTML will continue to be useful in environments where there are no preconceived notions about how elements should be rendered in a browser. The approach is one in which developers will be able to extend in unanticipated ways as new technologies and display media emerge. Its modular design reflects the realization that a one-size-fits-all approach to the Web no longer works, especially when browsers differ significantly and cell phones have limited memory and screen size for display.

XHTML Modularization

XHTML modules build a base for the future.

The capability of XHTML to be more flexible than HTML is attributable to the use of XHTML modules for creating XHTML-conforming markup languages. New XHTML-compliant languages must use the basic XHTML framework as well as other XHTML modules. As illustrated in Figure 2.13, modules plug together within the XHTML framework to define a markup language that is task or client specific. Documents developed based on the new markup language will be usable on any XHTML-conforming clients .

Figure 2.13. The structure of XHTML.

graphics/02fig13.jpg

XHTML allows specialized markup languages to be developed.

In some instances, people will create complete, proprietary markup languages using XHTML. People may also create new, reusable modules that will find use within their own or other organizations. The architecture and technology behind XHTML are already finding use within the W3C by organizations such as the Organization for the Advancement of Structured Information Standards (OASIS) and Project Gutenberg, which are using XHTML modularization to create new markup languages for industry-specific applications. XHTML is also finding applicability within the wireless industry that sees it as the next-generation language of choice for NTT DoCoMo's i-mode cell phones and as the WAP Forum's replacement technology for WML.

VoiceXML

VoiceXML uses XML text to drive voice dialogs.

VoiceXML is an emerging standard for speech-enabled applications. Its XML syntax defines elements to control a sequence of interaction dialogs between a user and an implementation platform. The elements defined as part of VoiceXML control dialogs and rules for presenting information to and extracting information from an end-user using speech. For ZwiftBooks, VoiceXML opens up options for extending its service to voice through cellular networks.

As Figure 2.14 illustrates, VoiceXML documents are stored on Web servers. Translation from text to voice is carried out either on a specialized server that delivers voice directly to a phone or by the device itself using speech processing technology.

Figure 2.14. VoiceXML documents are used to drive voice interactions over conventional or wireless phones.

graphics/02fig14.jpg

Just as a Web browser interprets HTML and displays it on the screen, a VoiceXML browser understands VoiceXML markup and interprets it for presentation over the telephone or directly to an audio channel. As mobile devices such as cell phones acquire additional processing power, it will be possible to deliver VoiceXML documents directly to cell phones for VoiceXML processing.

The VoiceXML document specifies each interaction dialog. User input affects dialog interpretation and is collected into requests that go back to the VoiceXML server. The server may reply with another VoiceXML document to continue the user's session with other dialogs.

A VoiceXML document includes tags defining both audio prompts and logic. For example, the content of a prompt tag is converted by a VoiceXML browser to speech. Other VoiceXML tags include form for building a voice-driven form to collect user information and menu , which leads an end-user through a series of menu selections.

Forms and Menus

VoiceXML supports both forms and menus.

There are two kinds of dialogs: forms and menus. Forms define an interaction that collects values for a group of fields. Each field may specify a grammar that controls the allowable inputs for that field. Menus present the user with a choice of options and then transition to another dialog based on that choice.

Forms also contain subdialogs that provide a mechanism for triggering a new interaction and returning to the original form. Subdialogs can be used to create a confirmation sequence that may require a database query, a set of components for sharing among documents in a single application, or a reusable library of dialogs shared across many applications.


Team-Fly    
Top


XML, Web Services, and the Data Revolution
XML, Web Services, and the Data Revolution
ISBN: 0201776413
EAN: 2147483647
Year: 2002
Pages: 106
Authors: Frank Coyle

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net