Opentopia Directory Encyclopedia Tools

XHTML

Encyclopedia : X : XH : XHT : XHTML


HTML
Cascading Style Sheets
Character encodings
Layout engine comparison
Dynamic HTML
Font family
HTML editor
HTML element
HTML scripting
Unicode and HTML
Web colors
W3C
XHTML
[ edit ]
The Extensible HyperText Markup Language, or XHTML, is a markup language that has the same expressive possibilities as HTML, but a stricter syntax. Whereas HTML is an application of SGML, a very flexible markup language, XHTML is an application of XML, a more restrictive subset of SGML. Because they need to be well-formed (syntactically correct), XHTML documents allow for automated processing to be performed using a standard XML library—unlike HTML, which requires a relatively complex, lenient, and generally custom parser (though an SGML parser library could possibly be used). XHTML can be thought of as the intersection of HTML and XML in many respects, since it is a reformulation of HTML in XML. XHTML 1.0 became a World Wide Web Consortium (W3C) Recommendation on January 26, 2000.

Overview

XHTML is the successor to HTML. As such, many consider XHTML to be the “current version” of HTML, but it is a separate, parallel recommendation; the W3C continues to recommend the use of XHTML 1.1, XHTML 1.0, and HTML 4.01 for web publishing.

The need for a more strict version of HTML was felt primarily because World Wide Web content now needs to be delivered to many devices (like mobile devices) apart from traditional computers, where extra resources cannot be devoted to support the additional complexity of HTML syntax.

Most of the recent versions of popular web browsers render XHTML properly, but many older browsers can only render XHTML as HTML. Similarly, almost all web browsers that are compatible with XHTML also render HTML properly. Some argue this compatibility is slowing the switch from HTML to XHTML. During October 2005 approximately 10% of web surfers were using browsers capable of rendering XHTML properly. [link] Microsoft's Internet Explorer is incompatible with some XHTML recommendations, despite Microsoft's full membership in the W3C. [link] Therefore, most web content authors are forced to choose between writing valid, standards-compliant documents and providing content that renders properly on the browsers of most visitors.

An especially useful feature of XHTML is that elements from different XML namespaces (such as MathML and Scalable Vector Graphics) can be incorporated within it. However, this feature is only available when serving XHTML as actual XML with the application/xhtml+xml MIME-type.

The changes from HTML to first-generation XHTML (i.e. XHTML 1.x) are minor, and are mainly to achieve conformance with XML. The most important change is the requirement that the document must be well formed and that all elements must be explicitly closed as required in XML. Since XML's tags are case-sensitive, the XHTML recommendation has defined all tag names to be lowercase. This is in direct contrast to established traditions which began around the time of HTML 2.0, when most people preferred uppercase tags, generally to show the contrast between mark-up and context easier to the human editor. In XHTML, all attribute values must be enclosed by quotes (either 'single' or "double" quotes may be used). In contrast, this was optional in SGML, and hence in HTML, where quotes may be omitted in some circumstances. All elements must also be explicitly closed, including empty elements such as img and br. This can be done by adding a closing slash to the start tag: and
. Attribute minimization (e.g., ) is also prohibited as the attribute “selected” contains no explicit value; instead, use . More differences are detailed in the W3C XHTML 1.0 recommendation [link].

Versions of XHTML

XHTML 1.0

The original XHTML W3C Recommendation, XHTML 1.0, was simply a reformulation of HTML 4.01 in XML. There are three different "flavors" of XHTML 1.0, each equal in scope to their respective HTML 4.01 versions.