Shaun McCance
shaunm@gnome.org 2007-2009
Link to other pages, sections, or web pages.

# Hyperlinks

    mal_inline_link = element link {
      ( attribute xref { text } |
        attribute href { text } |
        ( attribute xref { text }, attribute href { text } )
      ),
      attribute role { text } ?,
      attribute style { xsd:NMTOKENS } ?,
      attribute * - (mal:* | local:*) { text } *,

      mal_inline
    }

Use the `link` to create a link to another page or section, or to an external resource such as a web page. Most inline elements can act as links, but the `link` element allows you to create a link without any associated semantics. The `link` element can also generate link text automatically for links to pages and sections within the same document.

# Anmerkungen

The `link` element can contain a mixture of text and any general inline elements.

Für Links innerhalb des gleichen Elements kann der Inhalt automatisch erzeugt werden.

The `link` element can occur in any general inline context, including inside most inline elements, some basic block elements, and certain informational elements.

The `xref` attribute creates a link to another page or section within the same document, or to an external resource in some document management system.

The `href` attribute creates a link to a web page or other network-accessible resource.

The `role` attribute can be used to select alternative titles of the target page or section to be used as automatic content.

The `style` attribute takes a space-separated list of style hints. Processing tools should adjust their behavior according to those style hints they understand.

The `link` element can have attributes from external namespaces. See for more information on external-namespace attributes.

# Beispiele

Verlinken zu einer anderen Seite im gleichen Element:

See <link xref="mal_attr_link"/> for information on linking attributes.

See for information on linking attributes.

Link zu einem Abschnitt der gleichen Seite:

See <link xref="#processing"/> for details on automatic link text.

See for details on automatic link text.

Link zu einem Abschnitt einer anderen Seite:

See <link xref="mal_inline#processing"/> for more processing expectations.

See for more processing expectations.

Link zu einer externen Ressource:

See the <link href="http://www.w3.org/TR/REC-xml-names/">XML Namespaces recommendation</link>.

See the XML Namespaces recommendation.

# Processing Expectations

A `link` element is displayed as hyperlink which can be clicked on or otherwise activated to take the user to another page, document, or resource. In certain environments, such as print, it may not be possible to make links activatable. In these cases, the target of the link may be displayed in the rendered output.

The target of `link` element is determined from the `xref` and `href` exactly as it is for other inline elements. See for information on determining the link target.

If the `link` element is non-empty, its contents are displayed as normal. Otherwise, automatic link text is generated as follows:

If the `link` element has an `xref` attribute that points to a page or section in the same document:

If the `link` element has a `role` attribute, and that page or section has an informational title with the `type` attribute set to `"link"` and the `role` set to the same value as the `role` attribute of the `link` element, then the contents of that `title` element are used.

Otherwise, if that page or section has an informational title with the `type` attribute set to `"link"` and without a `role` attribute, the contents of that `title` element are used.

Otherwise, the contents of the primary title of that page page or section are used.

Otherwise, if the `link` element has an `xref` attribute that points to a portion of another document, and the processing tool knows how to generate link contents, that content is used.

Otherwise, the link target is used as text content.

# Vergleich mit anderen Formaten

The `link` element combines the functionality of the `link`, `xref`, and `ulink` elements in DocBook. For the `link` and `xref` elements, DocBook provides the `endterm` attribute to select an alternative element from which to take content. Mallard does not provide this feature, although it allows you to select from alternative titles for the linked-to element.

DocBook provides the `xrefstyle` attribute to control how automatic link text is generated. The behavior of this attribute is unspecified. Rather than attempt to use style hints, Mallard allows writers to specify exact alternative link contents. Alternative link contents are important in languages with case declensions.