13. XHTML Hypertext Attributes Module

Contents

This section is normative.

The Hypertext Attributes Module defines the Hypertext attribute collection. This collection allows an element to be the start point of a hypertext link to a remote resource.

13.1. Hypertext Attribute Collection

href = URI
This attribute specifies a URI that is actuated when the element is activated.

Actuation occurs as the default action of a [DOM] DOMActivate event for the element that the attribute occurs on.

Examples:
<abbr href="http://www.w3.org/" title="World Wide Web">WWW</abbr>
<li href="contents.xhtml">contents</li>
<a href="http://www.cwi.nl/~steven/amsterdam.html">Amsterdam</a>
<quote href="hamlet.xhtml#p2435">To be or not to be</quote>
<var href="#index_ninc">ninc</var>

In terms of [HLINK], the href attribute is specified as:

<hlink namespace="http://www.w3.org/2002/06/xhtml2"
       locator="href"
       effectValue="replace"
       replacement="target"
       role="rel"
       mediaType="hreftype"
       actuateValue="onRequest"/>
hreftype = ContentTypes

This attribute specifies the allowable content types of the relevant href URI. At its most general, it is a comma-separated list of media ranges with optional accept parameters, as defined in section 14.1 of [RFC2616] as the field value of the accept request header.

In its simplest case, this is just a media type, such as "image/png" or "application/xml", but it may also contain asterisks, such as "image/*" or "*/*", or lists of acceptable media types, such as "image/png, image/gif, image/jpeg".

The user agent must combine this list it with its own list of acceptable media types by taking the intersection, and then use the resulting list as the field value of the accept request header when requesting the resource using HTTP.

For instance, if the attribute specifies the value "image/png, image/gif, image/jpeg", but the user agent does not accept images of type "image/gif" then the resultant accept header would contain "image/png, image/jpeg".

A user agent should imitate similar behavior when using other methods than HTTP. For instance, when accessing files in a local filestore, <p src="logo" type="image/png, image/jpeg"> might cause the user agent first to look for a file logo.png, and then for logo.jpg.

If this attribute is not present, "*/*" is used for its value.

For the current list of registered content types, please consult [MIMETYPES].

Example:
<p href="http://www.w3.org" hreftype="text/html,application/xhtml+xml">
   The W3C Home Page
</p>
hreflang = LanguageCodes

This attribute specifies the base language of the resource designated by href and may only be used when href is specified. At its most general, it is a comma-separated list of language ranges with optional accept parameters, as defined in section 14.5 of [RFC2616] as the field value of the Accept-Language request header.

In its simplest case, this is just a language code, such as "nl", but it may also contain variant specifications such as "en-gb".

The user agent must use this list as the field value of the accept-language request header when requesting the resource using HTTP.

If this attribute is not present, the user agent must use its default value of the accept-language request header.

Example:
<p href="http://www.w3.org/2003/06/semantictour-pressrelease" hreflang="fr">
   The press release in French
</p>
cite = URI
The value of this attribute is a URI that designates a source document or message. This attribute is intended to give further information about the element's contents (e.g., the source from which a quotation was borrowed, or the reason text was inserted or deleted). User Agents should provide a means for the user to access the further information.
Example:
cite="comments.html"

In terms of [HLINK], the cite attribute is specified as:

<hlink namespace="http://www.w3.org/2002/06/xhtml2"
       locator="cite"
       effectValue="new"
       actuateValue="onRequestSecondary"/>
target = HrefTarget
This attribute identifies an environment that will act as the destination for a resource identified by a hyperlink when it is activated.

This specification does not define how this attribute gets used, since that is defined by the environment that the hyperlink is actuated in. See for instance XFrames [XFRAMES].

Example:
<a href="home.html" target="main">Home</a>
access = QName
This attribute assigns an access name to an element which is used to allow faster access to important parts of a document, by allowing shortcuts to be bound to them.

Activating an access shortcut bound to an element gives focus to the element. The action that occurs when an element receives focus depends on the element. For example, when a user activates a link defined by the a element, the user agent generally follows the link. When a user activates a radio button, the user agent changes the value of the radio button. When the user activates a text field, it allows input, etc.

Access names do not have to be unique in a document. Activating a shortcut takes the user to the next element with the bound-to name.

In this example, we assign the access name "contents" to a link. Using the binding assigned to this location takes the user to another document, in this case, a table of contents.

<p access="contents"
   href="http://example.com/specification/contents.html">
  Table of Contents
</p>
shortcuts

The invocation of access shortcuts, and the assignment of key or other bindings to them is not further defined here. A user agent should allow the user to access the user agent's list of recognized access points, to add to them, and to specify bindings for them.

Access attribute needs list of standard access points

A list of access points (such as 'main content', 'navigation list', 'submit button' is in preparation
nextfocus = IDREF
This attribute specifies an IDREF of an element in the current document that will receive focus when the user requests that user agent navigate to the next element that can receive focus.

The elements in a document that can be "activated" are called "focusable" elements. The sequence of focusable elements is called the document's navigation order. The navigation order defines the order in which elements will receive focus when navigated by the user. The navigation order may include elements nested within other elements.

When a document is first loaded, a user agent must do the following:

  1. If a document is loaded using a URI that includes a fragment reference (such as book.html#chapter5)
    1. If the fragment reference identifies an element in the document, the user agent must ensure that navigation starts at the beginning of that element.
    2. If the referenced element is focusable, that element receives focus.
    3. If the fragment reference does not resolve in the document, the user agent must ensure navigation starts at the beginning of the document.
  2. If there is no fragment reference when the document is loaded:
    1. If the root element of the document has a nextfocus attribute, and the element referred to by the attribute is focusable, the element must receive focus. The used agent must ensure the beginning of the element is visible on the display.
    2. If the root element has no nextfocus attribute, no element receives initial focus. The user agent must ensure navigation starts at the beginning of the document.
  3. If the user has moved away from the initial navigation point of a document (e.g., through using page up and page down or by changing focus), refreshing the document should result in the user's navigation location being preserved.

In the event no element in the document has focus, when the user requests the next focusable element, that element must be the next focusable element forward from the current navigation point in document order. If there are no focusable elements before the end of the document, focus shifts to the first focusable element in document order. If a document has no focusable elements, the behavior is unspecified.

Once a focusable element in the document has focus, upon requesting that focus change to the next focusable element, the user agent must do the following:

  1. If the focused element has a nextfocus attribute that references a focusable element, focus is moved to that element.
  2. Otherwise, focus shifts to the next focusable element in document order.
  3. If there are no remaining focusable elements in document order, focus shifts to the first focusable element in document order.

Regardless of the way in which an element receives focus, if the element is not currently visible on the user agent's display, the display must be updated so that the element is visible.

The following example would allow the links to be navigated in column order (without the use of nextfocus they would be navigated in document, i.e. row, order):

<table>
<tr><td id="a" nextfocus="b">NW</td>
    <td id="c" nextfocus="d">NE</td></tr>
<tr><td id="b" nextfocus="c">SW</td>
    <td id="d">SE</td></tr>
</table>

Navigation keys. The actual key sequence that causes navigation or element activation depends on the configuration of the user agent (e.g., the "tab" key might be used for navigation and the "enter" key or "space" key used to activate a selected element).

prevfocus = IDREF
This attribute specifies an IDREF of an element in the current document that will receive focus when the user requests that user agent navigate to the previous element that can receive focus.

The elements in a document that can be "activated" are called "focusable" elements. The sequence of focusable elements is called the document's navigation order. The navigation order defines the order in which elements will receive focus when navigated by the user. The navigation order may include elements nested within other elements.

In the event no element in the document has focus, when the user requests the previous focusable element, that element must be the next focusable element backward from the current navigation point in document order. If there is no such focusable element back to the start of the document, focus shifts to the last focusable element in document order. If a document has no focusable elements, the behavior is unspecified.

Once a focusable element in the document has focus, upon requesting that focus change to the previous focusable element, the user agent must do the following:

  1. If the focused element has a prevfocus attribute that references a focusable element, focus is moved to that element.
  2. Otherwise, focus shifts to the previous focusable element in document order.
  3. If there are no previous focusable elements in document order, focus shifts to the last focusable element in document order.

Regardless of the way in which an element receives focus, for visual user agents, if the element is not currently visible on the user agent's display, the display must be updated so that the element is visible.

The following example would allow the links to be navigated in column order (without the use of nextfocus and prevfocus they would be navigated in document, i.e. row, order):

<table>
<tr>
    <td id="a" nextfocus="b"              >NW</td>
    <td id="c" nextfocus="d" prevfocus="b">NE</td></tr>
<tr>
    <td id="b" nextfocus="c" prevfocus="a">SW</td>
    <td id="d"               prevfocus="c">SE</td></tr>
</table>

Navigation keys. The actual key sequence that causes navigation depends on the configuration of the user agent (e.g., the "shift-tab" key might be used for navigation).

xml:base = URI
This attribute specifies the base URI from which to resolve relative URIs. It is normatively defined in [XMLBASE]. Any relative URI used on an element that uses this attribute, or on an element contained within an element that uses this attribute, must be resolved relative to the base URI defined by this attribute.

An element inherits URI base information according to the following order of precedence (highest to lowest):

Example:
See:
<ul xml:base="http://www.w3.org">
<li href="/" src="Icons/w3c_home">The W3C home page</li>
<li href="/TR">The W3C Technical Reports page</li>
<li href="/Markup">The HTML home page</li>
<li href="/Markup/Forms">The XForms home page</li>
</ul>

Implementation: RELAX NG