XHTML Versions

As you see in the <!DOCTYPE> element, I'm using the XHTML DTD that's called "XHTML 1.0 Transitional". That's only one of the XHTML DTDs available, although it's currently the most popular one. So, what XHTML DTDs are available, and what do they mean? That all depends on what version of XHTML that you are using.

XHTML Version 1.0

The standard version of XHTML, version 1.0, is just a rewrite of HTML 4.0 in XML. You can find the W3C recommendation for XHTML 1.0 at http://www.w3.org/TR/xhtml1. Essentially, it's just a set of DTDs that provide validity checks for documents that are supposed to mimic HTML 4.0 (actually, HTML 4.01). The W3C has created several DTDs for HTML 4.0, and the XHTML DTDs are based on those, translated into straight XML. As with HTML 4.0, XHTML 1.0 has three versions, which correspond to three DTDs here:

  • The strict XHTML 1.0 DTD. The strict DTD is based on straight HTML 4.0 and does not include support for elements and attributes that the W3C considers deprecated. This is the version of XHTML 1.0 that the W3C hopes people will migrate to in time.

  • The transitional XHTML 1.0 DTD. The transitional DTD is based on the transitional HTML 4.0 DTD. This DTD has support for the many elements and attributes that were deprecated in HTML 4.0 but that are still popular, such as the <CENTER> and <FONT> elements. This DTD is also named the "loose" DTD. It is the most popular version of XHTML at the moment.

  • The frameset XHTML 1.0 DTD. The frameset DTD is based on the frameset HTML 4.0 DTD. This is the DTD you should work with when you're creating pages based on frames: In that case, you replace the <BODY> element with a <FRAMESET> element. The DTD must reflect that, so you use the frameset DTD when working with frames. That's the difference between the XHTML 1.0 transitional and frameset DTDs—the frameset DTD replaces the <BODY> element with the <FRAMESET> element.

Here are the actual <!DOCTYPE> elements you should use in XHTML for these various DTDs—strict, transitional, and frameset—including the URIs for these DTDs:

<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

Because I'm giving the DTDs' URIs here, you can copy them and cache a local copy if you want for faster access. For example, if you place the DTD files in a directory named DTD in your Web site, your <!DOCTYPE> elements might look more like this:

<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "DTD/xhtml1-strict.dtd">

<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "DTD/xhtml1-transitional.dtd">

<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
     "DTD/xhtml1-frameset.dtd">

If you cache these DTDs locally, there should be less of a bottleneck when XHTML becomes very popular and users try to download your documents.

XHTML Version 1.1

There's also a new version of XHTML available, version 1.1. This version is not yet in W3C recommendation form; it's a working draft. You can find the current working draft of XHTML 1.1 at http://www.w3.org/TR/xhtml11.

XHTML 1.1 is a strict version of XHTML, and it's clear that the W3C wants to wean HTML authors away from their loose ways into writing very tight XML. How far those HTML authors will follow is yet to be determined. XHTML 1.1 removes all the elements and attributes deprecated in HTML 4.0, and a few more as well.

<APPLET> Versus <OBJECT>

There's another interesting thing going on in XHTML 1.1: The W3C has long said that it wants to replace the <APPLET> and other elements with the Microsoft-supported <OBJECT> element. However, and surprisingly, <OBJECT> is missing from XHTML 1.1. And—surprise—the <APPLET> element is back.


XHTML 1.1 is so far ahead of the pack that many of the features that today's HTML authors and browsers use aren't supported there at all. Therefore, I'm going to stick to XHTML 1.0 transitional in the examples in this chapter and the next chapter. However, I'll also indicate which elements and attributes are supported by what versions of XHTML, including XHTML 1.1, throughout these chapters.

XHTML 1.0 Versus XHTML 1.1

You can find the differences between XHTML 1.0 and XHTML 1.1 at http://www.w3.org/TR/xhtml11/changes.html#a_changes.


When you want to use XHTML 1.1, here's the <!DOCTYPE> element you should use (there's only one XHTML 1.1 DTD, not three, as in XHTML 1.0):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

Another big difference between XHTML 1.1 and XHTML 1.0 goes beyond the support offered to various elements and attributes. XHTML is designed to be modular. In practice, this means that the XHTML 1.1 DTD is actually relatively short—it's a driver DTD, which inserts various other DTDs as modules. The benefit of modular DTDs is that you can omit the modules that your application doesn't support.

For example, if you're supporting XHTML 1.1 on a nonstandard device such as a PDA or even a cell phone or pager (the W3C has all kinds of big ideas for the future), you might not be able to support everything, such as tables or hyperlinks. With XHTML 1.1, all you need to do is to omit the DTD modules corresponding to tables and hyperlinks. (Several modules are marked as required in the XHTML 1.1 DTD, and those cannot be omitted.)

XHTML Basic

In fact, there's another version of XHTML that is also in the working draft stage: XHTML Basic. XHTML Basic is a very small subset of XHTML, reduced to a very minimum so that it can be supported by devices considerably simpler than standard PCs. You can find the current working draft for XHTML Basic at http://www.w3.org/TR/xhtml-basic.

If you want to use XML Basic, here's the <!DOCTYPE> element you should use:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
     "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.45.212