Read an Excerpt
1: Why Bother?Topics in this chapter:
- A quick and dirty introduction to XHTML
- Why you should care about XHTML
- Why you should bother reading this book
According to the W3C HTML Working Group, "XHTML 1.0 is the keystone in W3C's work to create standards that provide richer Web pages on an everincreasing range of browser platforms including cell phones, televisions, cars, wallet-sized wireless communicators, kiosks, and desktops. XHTML is modular, making it easy to combine with markup tags for things like vector graphics, multimedia, math, electronic commerce, and more. Content providers will find it easier to produce content for a wide range of platforms, with better assurances as to how the content is rendered. The modular design reflects the realization that a one-size-fits-all approach will no longer work in a world where browsers vary enormously in their capabilities."
Tim Berners-Lee, inventor of the Web and W3C founder and Director, adds, "XHTML 1.0 connects the present Web to the future Web. It provides the bridge to page and site authors for entering the structured data XML world, while still being able to maintain operability with user agents that support HTML 4."
Although XHTML is new, it holds great promise for the future of the Web. Internet experts from around the world agree that XHTML is the bridge that brings us to the next generation Web without burning our bridges to the past (see "XHTML Testimonials," later in this chapter, for details).
But really, why bother? Wasn't XML itself supposed to be the killer technology that enables our next generation Web sites? XML, after all, is a panacea for the Web's ills, isn't it? When it first arrived on the scene a few years ago, XML promised to usher in the age of the semantic Web, an age where well-formed, "validated" content enables automated data exchange and next generation Web sites. XML, according to many industry pundits, promises to obviate the need for HTML altogether in the near future. So why bother with a middleman like XHTML when you can go straight to XML?
Why not construct your current and future Web applications around XML lock, stock, and barrel, leaving HTML (and its newly anointed successor, XHTML) in the dust? If XHTML bridges the gap between HTML and XML, why not leap over that gap altogether and jump directly into XML today? In doing so, wouldn't you save yourself the hassle of learning yet another markup language, spare yourself the pain and suffering of developing, testing, and deploying Web content in yet another new and relatively unproven cutting-edge technology, and save yourself a few bucks on the cost of this book? The answer is no.
XML, in and of itself, is simply a metalanguage that lets you define other languages, of which XHTML is just one example. XHTML is an application of XML designed specifically for building Web pages. As the next evolution of HTML, XHTML is the language we'll use to construct cutting-edge Web sites now and in the foreseeable future. When you use XHTML you are, in fact, using XML. Because the two are inseparable, you can't skip over XHTML and go directly to XML, no matter how hard you might try.
Furthermore, you can't ignore HTML altogether when you use XHTML because the latter is based on the former. Whereas XHTML is an application of XML, XHTML gets its meaning from HTML. In other words, XHTML is HTML ex-pressed as an XML application. Or, as the W3C puts it, XHTML "is a reformulation of HTML 4.01 in XML, bringing the rigor of XML to HTML, and can be put to immediate use with existing browsers by following a few simple guidelines."
Take your pick. Either way both definitions boil down to the same thing: XHTML extends the life of HTML using XML. And it's ready to be used in your Web site now. You can convert your existing HTML pages into XHTML this very moment because XHTML is backward compatible with HTML and future compatible with other XML languages. In short, XHTML is the best of both worlds.
XML is not an application language. It is the set of rules by which one designs an application language such as XHTML. XHTML is an application of XML that gets its meaning from HTML. XHTML is the next major evolution of HTML, and as such will dominate as a Web development markup language for the foreseeable future.
Because XHTML is backward compatible with HTML, properly constructed XHTML pages can be delivered to standard Web browsers today. You can tap into many of the advantages that XML offers by way of XHTML. This book shows you how.
As you'll soon see, XML is just one piece of a very large puzzle, a puzzle in which HTML and XHTML fit tongue-and-groove, as illustrated in Figure 1–1. In this book we'll piece together the sometimes mysterious and complicated Web development puzzle, with a strong emphasis on XHTML Web page development. We'll see how critical technologies such as HTML, XHTML, and XML come together—along with several other W3C technologies—to create sophisticated Web content that we could only dream about a few years ago.
In particular, you'll learn why you should convert your existing HTML pages to XHTMLtoday, and how to go about it once you've made the commitment to do so. You'll also learn how to create static and interactive XHTML Web pages from scratch, and how to enrich them with various XML-based languages such as Synchronized Multimedia Integration Layer (SMIL), Scaleable Vector Graphics (SVG), Math Markup Language (MathML), and the Extensible 3D (X3D) language.
Finally, you'll learn how to prepare your Web site for the rapidly emerging mobile invasion by creating XHTML content that can be deployed across a variety of mobile devices, including Web-enabled cellular phones and Personal Digital Assistants (PDAs). Along the way you'll learn how to code XHTML by hand, as...