XHTML ( Extensible HyperText Markup Language ) is a markup language used to write pages for the World Wide Web . Originally conceived as the successor of HTML , XHTML is based on the syntax defined by XML , which is more recent, but simpler than the one defined by SGML on which HTML is based . At the time, it was necessary to take advantage of the technical benefits expected from the simplification offered by XML.
The name XHTML
Like many languages based on XML , it starts with the letter X, which represents the word extensible . So the first document officially describing XHTML is called XHTML 1.0 The Extensible HyperText Markup Language 1 (“XHTML 1.0 The Extensible Hypertext Markup Language “). However, it is the abbreviation XHTML which is a mark 2 of the World Wide Web Consortium (W3C) and which is used only in the specifications that followed version 1.0.
XHTML, evolution of HTML
XHTML 1.0 simply reformulates HTML 4 in application of XML 1.0. The syntax only changes, no functionality has been added or removed. Converting a document into HTML 4.01 compliant in XHTML 1.0 can be done automatically without loss of information.
XHTML 1.0 became a recommendation of W3C in 2000 3 , and the XHTML 1.1 in 2001 4 . Throughout the years 2000, HTML 4 and XHTML are both used by developers and interpreted by web browsers .
Conversion of HTML to XHTML
This example illustrates the most common syntactic differences between a document written in HTML 4 and XHTML 1.0.
<! DOCTYPE HTML PUBLIC "- // W3C // DTD HTML 4.01 // EN"> < title > Example HTML 4 </ title > < ul > < li > Items like HTML, HEAD and BODY are implicit, And closing are optional. </ Li > < li > Many closing tags are optional, especially for P (paragraph) and LI (list entry). < Li > Element and attribute names can < EM Class = "important" > Freely </ Em > mix uppercase and lowercase. </ Li > < li > Some attributes have a default value of < input type = "checkbox" checked value = "..." > . </ Li > < li > The quotes are not < em class = significant > always </ em > required around attribute values. < / Li > < li > Empty elements do not have syntax closing < img src = "i.png" alt = "i" > . </ Li > </ ul >
In contrast to the permissive HTML syntax above, the same document must be “trained” 5 to comply with the rules of writing XHTML:
<! DOCTYPE html PUBLIC "- // W3C // DTD XHTML 1.0 Strict // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns = "http Http://www.w3.org/1999/xhtml " > <head> <title> Example XHTML 1.0 </ title> </ head> <body> <ul> <li> All elements must be explicitly tagged. </ Li> <li> Closing tags are not optional. </ Li> <li> Element and attribute names <em class = "important" > must </ em> Be in lower case. </ Li> <li> All attributes must have an explicit value <input type = "checkbox" checked = "checked" value = "..." /> . </ li> <li> The quotes are <em class = "important" > always </ em> required around attribute values. </ Li> <li> Empty elements must be closed <img src = "i.png" alt = "i" /> . </ Li>
Modularization of XHTML
The following evolutions divide the XHTML language into modules, each grouping a type of functionality. This division is designed to extend the format, or, conversely, to draw subsets adapted to specific contexts. So :
- XHTML1.1 enriches XHTML1.0 with the element
rubyallowing to add annotations to the texts written in ideographic languages (Japanese, Hebrew, Chinese …)
- XHTML BASIC is a simplified subset, designed to adapt content to thin clients (mobile)
Development of XHTML 2.0
XHTML 2.0 was under development. It should not be compatible in ancestry and progeny , in particular because of the introduction of XForms and XFrames .
Finally on July 2, 2009 the W3C officially announced the abandonment of the development of the XHTML 2 6 in order to devote itself entirely to its new successor: the HTML 5 .
Document Valid XHTML
For a document to be valid XHTML, it must have a type declaration (DOCTYPE) and an encoding (ISO or UTF) according to the specifications of the W3C .
The XML declaration
The XML declaration is only required in a few encoding conditions (character set other than TUT-8 in particular), and when the document is processed as an XML document (content type
Depending on the selected character set, the document can start with the following statement in the first line:
<? Xml version = "1.0" encoding = "iso-8859-1"?>
Some examples of Document Type Declaration in XHTML:
XHTML 1.0 Strict
<! DOCTYPE html PUBLIC "- // W3C // DTD XHTML 1.0 Strict // EN" " Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd [ archive ] ">
XHTML 1.0 Transitional
<! DOCTYPE html PUBLIC "- // W3C // DTD XHTML 1.0 Transitional // EN" " Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd [ archive ] ">
XHTML 1.0 Frameset
<! DOCTYPE html PUBLIC "- // W3C // DTD XHTML 1.0 Frameset // EN" " Http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd [ archive ] ">
langis required only in the case of an XHTML 1.0 document
text/htmlprocessed as a document , based on XHTML / HTML compatibility (non-normative) recommendations. It will then be written:
<Html xmlns = " http://www.w3.org/1999/xhtml [ archive ] " xml: lang = "en" lang = "en">
In an XHTML 1.0 document that
application/xhtml+xmlis processed as a document or in an XHTML 1.1 document and beyond, we must write:
<Html xmlns = " http://www.w3.org/1999/xhtml [ archive ] " xml: lang = "en">
Notes and references
- ↑ ( en ) XHTML 1.0 The Extensible HyperText Markup Language [ archive ]
- ↑ ( in ) W3C Trademarks and Generic Terms [ archive ]
- ↑ ( en ) W3C Recommendation: XHTML 1.0 The Extensible HyperText Markup Language (Second Edition) [ archive ]
- ↑ ( en ) W3C Recommendation: XHTML 1.1 – Module-based XHTML – Second Edition [ archive ]
- ↑ ( en ) Documents must be well-formed, XHTML 1.0 specification, W3C [ archive ]
- ↑ ( en ) Frequently Asked Questions about the future of XHTML [ archive ]
- XHTML 1.0
- W3C Recommendation: XHTML 1.0 The Extensible HyperText Markup Language (Second Edition) [ archive ] ( in )
- XHTML 1.1
- W3C Recommendation: XHTML 1.1 – Module-based XHTML – Second Edition [ archive ] ( in )
- W3C Recommendation: Basic XHTML 1.1 [ archive ] ( in )
- W3C Working Draft: An XHTML + MathML + SVG Profile [ archive ] ( in )
- XHTML 2.0
- W3C Working Draft: XHTML 2.0 [ archive ] ( in )
- HTML Category [ archive ] of the DMOZ directory also covers the XHTML theme
Translations of W3C Recommendations
- XHTML 1.0: Extensible Hypertext Markup Language [ archive ]
- Basic XHTML [ archive ]
- XHTML 1.1 – Modular XHTML [ Archive ]
- ( In ) Validator W3C (English version) [ archive ]