HTML: The Definitive Guide

Previous Chapter 6 Next
 

6.8 Supporting Document Automation

There are two additional header tags whose primary function is to support document automation, interacting with the Web server itself and document-generation tools.

The <meta> Header Element

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

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 HTML 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-and-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.

The name attribute

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

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

The content attribute

The content attribute provides the value of the name/value pair. It can be any valid string, enclosed in quotes, if necessary. 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">

You could also include a list of keywords related to the document, such as

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

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="keywords" 
  content="kumquats, cooking, peeling, eating">
<meta http-equiv="expires" content="31 Dec 99">

causes the header sent to the browser to contain

content-type: text/html
keywords: kumquats, cooking, peeling, eating
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.

The <nextid> Header Element

This tag appears in the HTML standard for historical reasons and should not be used.

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

The n attribute

The n attribute specifies the name of the next generated fragment identifier. Although the HTML standard does not define the format of this name, 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, then, to successively name fragment identifiers DOC54, DOC55, and so forth within this document.


Previous Home Next
Establishing Document Relationships Book Index Formatted Lists