start page | rating of books | rating of authors | reviews | copyrights

Book HomeHTML & XHTML: The Definitive GuideSearch this book

6.8. Supporting Document Automation

There are two additional header tags that have the primary function of supporting document automation, and interacting with the web server itself and document-generation tools.

6.8.1. The <meta> Header Element

Given the rich set of header tags for defining a document and its relationship with others that go unused by most authors, you'd think we'd all be satisfied.

<meta>

Function:

Supply additional information about a document

Attributes:

CHARSET

LANG

CONTENT

NAME

DIR

SCHEME

HTTP_EQUIV

End tag:

None in HTML; </meta> or <meta ... /> with XHTML

Contains:

Nothing

Used in:

head_content

But no. There's always someone with special needs. They want to be able to give even more information about their precious document, information that might be used by browsers, readers of the source, or by document-indexing tools. The <meta> tag is for you who need to go beyond the beyond.

The <meta> tag belongs in the document header and has no content. Instead, attributes of the tag define name/value pairs that associate the document. In certain cases, these values are used by the web server serving the document to further define the document content type to the browser.

6.8.1.1. The name attribute

The name attribute supplies the name of the name/value pair defined by the <meta> tag. Neither the HTML nor the XHTML standard specify any predefined <meta> names. In general, you are free to use any name that makes sense to you and other readers of your source document.

One common name used is keywords, which defines a set of keywords for the document. When encountered by any of the popular search engines on the Web, these keywords will be used to categorize the document. If you want your documents to be indexed by a search engine, consider putting this kind of tag in the <head> of each document:

<meta name="keywords" content="kumquats, cooking, peeling, eating">

If the name attribute is not provided, the name of the name/value pair is taken from the http-equiv attribute.

6.8.1.2. The content attribute

The content attribute provides the value of the name/value pair. It can be any valid string, enclosed in quotes, if it contains spaces. It should always be specified in conjunction with either a name or http-equiv attribute.

As an example, you might place the author's name in a document with:

<meta name="Authors" content="Chuck Musciano & Bill Kennedy">

6.8.1.3. The http-equiv attribute

The http-equiv attribute supplies a name for the name/value pair and instructs the server to include the name/value pair in the MIME document header that is passed to the browser before sending the actual document.

When a server sends a document to a browser, it first sends a number of name/value pairs. While some servers might send a number of these pairs, all servers send at least one:

content-type: text/html

This tells the browser to expect to receive an HTML document.

When you use the <meta> tag with the http-equiv attribute, the server will add your name/value pairs to the content header it sends to the browser. For example, adding:

<meta http-equiv="charset" content="iso-8859-1">
<meta http-equiv="expires" content="31 Dec 99">

causes the header sent to the browser to contain:

content-type: text/html
charset: iso-8859-1
expires: 31 Dec 99

Of course, adding these additional header fields makes sense only if your browser accepts the fields and uses them in some appropriate manner.

6.8.1.4. The charset attribute

Internet Explorer provides explicit support for a charset attribute in the <meta> tag. Set the value of the attribute to the name of the character set to be used for the document. This is not the recommended way to define a document's character set. Rather, we recommend always using the http-equiv and content attributes to define the character set.

6.8.1.5. The scheme attribute

This attribute specifies the scheme to be used to interpret the property's value. This scheme should be defined within the profile specified by the profile attribute of the <head> tag. Section 3.7.1, "The <head> Tag"

6.8.2. The <nextid> Header Element

This tag is not defined in the HTML 4 or XHTML standards and should not be used. We describe it here for historical reasons.

<nextid>

Function:

Define the next valid document entity identifier

Attributes:

n

End tag:

None

Contains:

Nothing

Used in:

head_content

The idea behind the <nextid> tag is to provide some way of automatically indexing fragment identifiers.

6.8.2.1. The n attribute

The n attribute specifies the name of the next generated fragment identifier. It is typically an alphabetic string followed by a two-digit number. A typical <nextid> tag might look like this:

<html>
<head>
<nextid n=DOC54>
</head>
...

An automatic-document generator might use the nextid information to successively name fragment identifiers DOC54, DOC55, and so forth within this document.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.