和荣笔记 - XSL-FO 与 XHTML
杨和荣, 版本 2.03, 2007年

eXtensible Hyper-Text Markup Language (XHTML)

What is XHTML

XHTML: A markup language for organizing information to be presented on the World Wide Web (WWW). XHTML is an improvement of HTML to meet the XML standard.

XHTML is recommended and maintained by w3c.org. There are two versions available at this time:

Features of XHTML:

  • XHTML is XML comforming. So it can be parsed by any XML parsers.
  • XHTML can be validated against specified XML Schemas.
  • XHTML can be transformed according to specified XSL Templates.
  • XHTML can be formated according to specified XSL Formatting Objects inside specified XSL Templates.
  • XHTML can, of course, be viewed by Web browsers directly.

Since XHMTL 2.0 is still a draft, I will discuss XHMTL 1.0 only in this node.

"Hello world!" Example of XHTML

1. Use any text editor to enter the following lines of text into a file:

<?xml version="1.0"?>
<html><body>Hello world!</body></html>

2. Save this file with name: "hello.xhtml".

Congratulations! You have successfully created an XHTML file.

Differences between HTML and XHTML

1. Elements must be properly nested. The following code is incorrect:

<p>This is an <em>emphasized term.</p></em>

2. Element and attribute names must be in lower case. The following code is incorrect:

<p CLASS="A">This is an <EM>emphasized term.</EM></p>

3. End tags are required for non-empty elements. The following code is incorrect:

<p>This is paragarm 1.
<p>This is paragarm 2.

4. Attributes must have values. The following code is incorrect:

<option selected>Red</option>
<option>Green</option>
<option>Blue</option>

5. Attribute values must be quoted. The following code is incorrect:

<p>This is a <font size=+1>bigger word</font>.</p>

6. Empty elements must be ended. The following code is incorrect:

<p>
This is line 1.<br>
This is line 2.
</p>
杨和荣,修改于2007年
和荣笔记 - XSL-FO 与 XHTML - eXtensible Hyper-Text Markup Language (XHTML)