HTML and CSS Reference
In-Depth Information
the root of the current server in the dtds directory:
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"/dtds/xhtml1-transitional.dtd">
You can download the DTDs from the W3C at www.w3.org/TR/2002/REC-xhtml1-20020801/xhtml1.zip and
install them wherever convenient. That archive contains the entire XHTML spec. You'll find the DTDs in the DTD
folder.
Pages that define framesets should use the frames DTD instead:
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
This is not necessary for pages that merely use an iframe for an ad or two. The transitional DTD works fine for
those.
You can automate these fixes fairly easily. TagSoup does not add DOCTYPE declarations, but Tidy does. Unless
asked otherwise, it defaults to the transitional DTD when run in XHTML mode.
This is also fairly easy to fix with multifile search and replace. Search for an html start-tag at the beginning of a
document, like this:
\A<html
You may want to allow for whitespace in front of the start-tag, too:
\A\s*<html
Then replace that with the desired DOCTYPE followed by <html .
Once you've added the DOCTYPE, validate all your documents, as discussed in Chapter 2 . This will reveal a
number of problems to fix. I'll detail some of the most common problems in subsequent sections in this chapter.
Search WWH ::




Custom Search