Home > Articles

Day Five: More About DTDs

  • Print
  • + Share This
XHTML expert Molly Holzschlag discusses the available DTDs for XHTML.

XHTML expert Molly Holzschlag discusses the available DTDs for XHTML.

In Day 4 of this miniseries on XHTML 1.0, I introduced the DTD, or Document Type Definition. A DTD is a document that contains listings for all the elements, attributes, values, and special characters—and how they are written—that are to be allowed in a given document.

XHTML 1.0 has only three DTDs available to authors, who must use one of them—and use it accurately—for the document to be considered valid XHTML 1.0. These three DTDs carry over from HTML 4.0:

  • XHTML 1.0 strict—This DTD is the most rigid of XHTML 1.0 DTDs. It contains only those elements and attributes that are current. So, while the p element, with opening and closing tags <p> . . . </p> is part of the strict XHTML 1.0 DTD, the font element, which has been deprecated (set aside for other, more current markup) since HTML 4.0 in favor of style sheets is not part of the strict XHTML 1.0 DTD. The strict DTD is declared in the DOCTYPE as follows:
  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  • XHTML 1.0 transitional—This DTD is very flexible and recognizes the fact that, to gain the best interoperability, many people must often use elements that are less desirable to do their job. So, in the transitional DTD, elements that are current and deprecated are included. You can write an XHTML 1.0 document using the font tag, and that document will be valid as long as you include the proper, transitional DTD declaration. Here's the transitional DTD in the DOCTYPE declaration:
  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  • XHTML 1.0 frameset—The frameset DTD exists to declare frameset documents only. So, if you're writing a frameset, you'll include the DOCTYPE definition and declare the frameset DTD. This DTD allows transitional or strict markup, but it must be declared only in the actual frameset document, not the documents that are called for by the frameset. The frameset DTD is declared as follows:
  • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"

As mentioned in Day 4's article, the DOCTYPE declaration appears at the top of the document.

It's important to mention that in XML, DTDs are part of what makes an application truly extensible. So, while XHTML 1.0 only has three DTDs, in future versions of XHTML—as is currently the case with XML—you will be able to write your own custom DTDs, or use other DTDs available from a wide range of sources. Let's say that you work in the medical field and have common terminology necessary to define information that you'd place in a document. If a DTD has been written by someone that defines elements that you require, you can use that DTD. Or, you can write your own DTD, creating a unique set of elements, attributes, values, characters and rules that customize your documents effectively.

About the Author

An author, instructor, and designer, Molly E. Holzschlag brings her irrepressible enthusiasm to books, classrooms, and Web sites. Honored as one of the Top 25 Most Influential Women on the Web, Molly has worked in the online world for an almost unprecedented decade. She has written and contributed to more than 10 books about the Internet and, in particular, the Web.

Molly holds a B.A. in communications and writing and an M.A. in media studies from the New School for Social Research. You can visit her Web site at http://www.molly.com/.

Molly's most recent publications are Special Edition Using XHTML(Que, November 2000), Sams Teach Yourself Adobe LiveMotion in 24 Hours (Sams, June 2000), and Special Edition Using HTML 4.0, Sixth Edition (Que, December 1999).

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.