• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Chapter 5. Extreme XHTML

The “X” in XHTML signifies HTML's addition to a large family of extensible, interoperable, and self-describing markup languages. This is the Extensible Markup Language (XML) family, which defines a general way to create application-specific markup languages for different purposes.[1] The XML clan frequently welcomes new members, including XHTML, Scalable Vector Graphics (SVG), and Rich Site Summary (RSS) for news syndication. In this chapter, you'll learn how to push XHTML to extremes, but abide by the family rules.

[1] Tim Bray et al., “Extensible Markup Language (XML) 1.0,” 2d ed. [online], (Cambridge, MA: World Wide Web Consortium, 2000), available from the Internet at http://www.w3.org/TR/REC-xml.

Extensible HTML (XHTML) 1.0 is HTML 4.01 reformulated as XML with many of XML's benefits.[2] A blend of the old and the new, XHTML acts as a bridge between the ad hoc HTML world and the more structured world of XML, the web's meta markup language.

[2] Steven Pemberton et al., “XHTML 1.0: The Extensible HyperText Markup Language,” 2d ed. [online], (Cambridge, MA: World Wide Web Consortium, 2002), available from the Internet at http://www.w3.org/TR/xhtml1/. A reformulation of HTML 4 in XML 1.0.

If you want your site to work with the largest possible audience and “future proof” it for the coming XML-based web, converting to XHTML is the way to go. XHTML is the first step toward XML and what Tim Berners-Lee calls “The Semantic Web.”[3]

[3] Tim Berners-Lee, James Hendler, and Ora Lassila, “The Semantic Web,” Scientific American 284, no. 5 (May 2001): 34-43. See also http://www.SemanticWeb.org.

XHTML documents are in fact XML documents with all of XML's syntactical requirements. XHTML documents must be “well-formed;” that is, all elements must be closed and properly nested. All attributes must be fully qualified and surrounded by double quotes. All XHTML elements and attributes must be lowercase, because XML is case sensitive and its DOCTYPEs prohibit mixed-or uppercase markup.

XHTML practically requires external JavaScripts and separate style sheets. Strict XHTML, on which XHTML 1.1 and 2 are based, prohibits presentational tags, forcing separation of presentation from structure. Strict XHTML documents closely resemble the pure structure of XML documents.

These stricter rules give XHTML a consistency unmatched by HTML and make it easier for automated agents and alternative browsers to access your content. Conversely, due to these stricter rules, XHTML offers fewer opportunities for optimization. Fortunately, many of the techniques discussed in Chapter 3, “HTML Optimization,” and Chapter 4, “Advanced HTML Optimization,” also can be applied to XHTML.

To get you started on the road to standards satori, this chapter first outlines the benefits of XHTML. Then you learn how XHTML works and how its rules differ from HTML. Finally, you discover ways you can optimize XHTML within these stricter confines.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint