What XHTML means for wireless development

XHTML is emerging as the content-authoring language for wireless development, so you'll need to have a strong grasp of XHTMLMod and XHTML Basic. See what you need to know about the changing wireless development landscape.

WAP2.0 specifies XHTML as the content-authoring language for the next-generation wireless access protocol. XHTML Mobile Profile is a subset of XHTML that provides a versatile and efficient way to program for various mobile devices. Content authored in this language will also be suitable for display in a PC-based environment. This article will examine the XHTML Mobile Profile, putting it in context in the larger XHTML framework, which includes XHTMLMod, XHTML Basic, and WML2.

W3C has defined XHTML 1.0 as the official Web markup standard, replacing HTML. Based on HTML 4.0, XHTML is HTML 4.1 with added modularity and strict conformance to XML rules. By offering a clean structure to Web pages across device types, XHTML, which is an XML application, is a key step toward the much needed integration of mobile Internet with the wired Internet. You can refer to our earlier article on XHTML for more information.

The W3C recommendation XHTMLMod specifies an abstract modularization of XHTML. This allows for subsetting and extending XHTML and makes it possible for XML standard specifications to specify well-defined sets of XHTML elements, which a certain category of devices need to support. Essentially, XHTML Modularization decomposes XHTML 1.0 into several abstract modules based on functionality. These modules can be combined to form XHTML subsets like XHTML Basic. Using XHTMLMod, you can form new document types by combining XHTML modules rather than dealing with different combinations and permutations of basic XHTML elements.

XHTML Basic is the mobile version of XHTML 1.0. Not all the elements of XHTML are required for the limited display, memory, and processing capabilities of a broad range of mobile devices such as mobile phones, PDAs, pagers, and set-top boxes. XHTML Basic makes use of modularization of XHTML and builds a document type that consists of a minimal set of modules from XHTML 1.0. Combining these with image, form, basic tables, and object support, XHTML Basic provides an XHTML document type that is implementation-efficient for small devices but rich enough for simple content authoring on such devices. The resulting document type is much more versatile compared to the WAP1.x content authoring language, WML.

XHTML Basic offers almost all the standard features available with mobile device-specific subsets of HTML, such as cHTML, WML, and HTML 4.0 guidelines for mobile access. These features include support for basic text formatting, forms, hyperlinks, basic tables, images, and meta information. Essentially, XHTML Basic is XHTML 1.0 minus capabilities such as frames, which are not very relevant for mobile devices with limited display capabilities. Other notable XHTML 1.0 features that aren't included in XHTML Basic are the style element (although you can still link to an external style sheet), script elements, and events elements. Also, only basic tables and forms are supported.

The XHTML Mobile Profile
XHTML Mobile Profile is the WAP forum’s definition of the authoring language for WAP2.0. XHTML Mobile Profile is designed for resource-constrained Web clients that do not support full XHTML features. It builds on XHTML Basic and adds a few more elements and attributes from XHTML 1.0. These essentially include some additional presentation elements and support for internal style sheets. Like XHTML Basic, XHTML Mobile Profile is a strict subset of XHTML 1.0.

Figure A shows the relationship between XHTML 1.0, XHTML Basic, and the XHTML Mobile Profile. Combined with WAP Cascading Style Sheets (WAP CSS), XHTML Mobile Profile provides a versatile environment for content presentation on a range of mobile device types supporting WAP2.0.

Figure A
Relationship between XHTML 1.0, XHTML Basic, and XHTML Mobile Profile

The Mobile Profile specification, WAP-277-XHTMLMP-20011029-a, defines the XHTML Mobile Profile document type based on the modules defined by XHTMLMod. Tables A and B list the modules and elements included in XHTML Basic and additional XHTML 1.0 modules, which are part of the XHTML Mobile Profile document type.
Table A
Module Element
Structure body.head.html.title
Hypertext a
Basic forms
Basic tables
Image img
Object object.param
Metainformation meta
Link link
Base base
XHTML basic modules and module elements: XHTML Mobile Profile, WAP-277-XHTMLMP-20011029-a
Table B
Module Element/Attributes
Forms(partial) filedset.optgroup
Legacy(partial) start attribute on ol.value
attribute on li
Style sheet style element
Style attribute style attribute
Additional modules and elements included in XHTML Mobile Profile, along with XHTML basic modules, XHTML Mobile Profile, WAP-277-XHTMLMP-20011029-a

The MIME media type for XHTML Mobile Profile is application/vnd.wap.xhtml+xml. It should be noted, though, that it is not essential for XHTML Mobile Profile documents to be associated with application/vnd.wap.xhtml+xml media type. Text/html can be used instead.

For a conforming document, there must be a DOCTYPE declaration with a public identifier. For example:

This declaration can be used to identify an XHTML Mobile Profile document in case the media type text/html is used.

Styling XHTML Mobile Profile documents
One of the main features in XHTML Mobile Profile that XHTML Basic excludes is the use of style elements. A WAP Application Environment (WAE) user agent supporting style sheets with XHTML Mobile Profile documents does so by supporting WAP CSS (mandatory), along with other style languages (optional). Styling an XHTML Mobile Profile document can be done either by using external style sheets, internal style information, or inline styling as described below.

Associating with a WAP CSS document
To associate a WAP CSS style in an XHTML Mobile Profile document, you employ a special XML processing instruction or a link element (located in the document header), as shown by the examples below:
<?xml-stylesheet href="example.css" media="handheld" type="text/css" ?>

<link href="example.css" type="text/css" rel="stylesheet"/>

Embedding style sheet information in the XHTML document itself
To embed the style sheet information, you use the style element (located in the document header), as shown by this example:
<style type="text/css">
  p { text-align: center; }

Localized styling
The style element can also be used to specify the formatting for a single element in the document body, as shown by this example:
<p style="text-align: center">...</p>

WML extensions to XHTML Mobile Profile
XHTML Mobile Profile doesn’t include features such as navigation aids, contexts, and “onenter” events, which are present in WML 1.x. WML2 is the combination of XHTML Mobile Profile and some WML features, which are available in WML2 using WML namespace (“wml:”). However, this WML namespace is optional. As a result, most browsers (with the exception of Openwave) support XHTML Mobile Profile without any WML namespace and with native support for WML 1.x.

By extending XHTML Basic with elements giving improved styling control, XHTML Mobile Profile provides an environment that should be versatile enough for a range of mobile and consumer devices and, at the same time, efficient to implement. Because XHTML Mobile Profile is a strict subset of XHTML 1.0, content authored in this language will also be suitable for display in a PC-based environment.

Editor's Picks