12. XHTML Linking Module


This section is normative.

The Link Module defines an element that can be used to define links to external resources. These resources are often used to augment the user agent's ability to process the associated XHTML document. The element and attributes included in this module are:

Elements Attributes Minimal Content Model
link Common, media (MediaDesc), EMPTY

When this module is used, it adds the link element to the content model of the head element as defined in the Structure Module.

Implementation: DTD

12.1. The link element


The Common collection
A collection of other attribute collections, including: Core, Events, I18N, Bi-directional, Edit, Embedding, and Hypertext
media = MediaDesc
The value of this attribute specifies the type of media for which the element is intended.

This element defines a link. Unlike a, it may only appear in the head section of a document, although it may appear any number of times. Although link has no content, it conveys relationship information that may be rendered by user agents in a variety of ways (e.g., a tool-bar with a drop-down menu of links).

XML linking support

The HTML Working Group is aware that there are issues surrounding various linking models that would permit generic XML user agents to support generic linking semantics and presentation. The Working Group is coordinating closely with other groups both inside and outside of the W3C to resolve these issues. In the interim, the underlying semantics of linking in XHTML 2.0 remain unspecified.

This example illustrates how several link definitions may appear in the head section of a document. The current document is "Chapter2.html". The rel attribute specifies the relationship of the linked document with the current document. The values "Index", "Next", and "Prev" are explained in the section on link types.

  <title>Chapter 2</title>
  <link rel="Index" href="../index.html"/>
  <link rel="Next"  href="Chapter3.html"/>
  <link rel="Prev"  href="Chapter1.html"/>

12.1.1. Forward and reverse links

While the rel attribute specifies a relationship from this document to another resource, the rev attribute specifies the reverse relationship.

Consider two documents A and B.

Document A:       <link href="docB" rel="foo"/>

Has exactly the same meaning as:

Document B:       <link href="docA" rev="foo"/>

Both the rel and rev attributes may be specified simultaneously.

12.1.2. Links and external style sheets

When the link element links an external style sheet to a document, the type attribute specifies the style sheet language and the media attribute specifies the intended rendering medium or media. User agents may save time by retrieving from the network only those style sheets that apply to the current device.

Media descriptors are further discussed under Attribute Types.

12.1.3. Links and search engines

Authors may use the link element to provide a variety of information to search engines, including:

The examples below illustrate how language information, media types, and link types may be combined to improve document handling by search engines.

The following example shows how to use the xml:lang attribute to indicate to a search engine where to find Dutch, Portuguese, and Arabic versions of a document. Note that this also indicates that the value of the title attribute for the link element designating the French manual is in French.

<title>The manual in English</title>
<link title="The manual in Dutch"
<link title="The manual in Portuguese"
<link title="The manual in Arabic"
<link lang="fr" title="La documentation en Fran&ccedil;ais"

In the following example, we tell search engines where to find the printed version of a manual.

<title>Reference manual</title>
<link media="print" 
      title="The manual in PostScript"

In the following example, we tell search engines where to find the front page of a collection of documents.

<title>Reference manual -- Page 5</title>
<link rel="Start" title="The first page of the manual"