W3C Logo

XML Linking Language (XLink)

W3C Working Draft 21-February-2000

This version:
http://www.w3.org/TR/2000/WD-xlink-20000221
Latest version:
http://www.w3.org/TR/xlink/
Previous version(s):
http://www.w3.org/TR/2000/WD-xlink-20000119
http://www.w3.org/TR/1999/WD-xlink-19991220
http://www.w3.org/1999/07/WD-xlink-19990726
http://www.w3.org/TR/1998/WD-xlink-19980303
http://www.w3.org/TR/WD-xml-link-970731
Editors:
Steve DeRose (Brown University) < Steven_DeRose@Brown.edu>
Eve Maler (Sun Microsystems) <elm@east.sun.com>
David Orchard (IBM Corp.) <dorchard@ca.ibm.com>
Ben Trafford (Invited Expert) <bent@exemplary.net>

Abstract

This specification defines the XML Linking Language (XLink), which allows elements to be inserted into XML documents in order to create and describe links between resources. It uses XML syntax to create structures that can describe the simple unidirectional hyperlinks of today's HTML, as well as more sophisticated links.

Status of this Document

The XML Linking Working Group invites Last Call comments on this 2000 February 21 XLink working draft. The Last Call period begins 21 February and ends 20 March 2000.

The W3C Membership and other interested parties are invited to review the specification and report first implementation experience. Please send comments to the public mailing list www-xml-linking-comments@w3.org (archive).

For background on this work, please see the XML Activity Statement. While we welcome implementation experience reports, the XML Linking Working Group will not allow early implementation to constrain its ability to make changes to this specification prior to final release.

For information about the XPointer language expected to be used with XLink, see [XPTR].

See [XLDP] for additional background on the design principles informing XLink.

See [XLREQ] for the normative XLink requirements that this document attempts to satisfy.

A list of current W3C Recommendations and other technical documents can be found at http://www.w3.org/TR.

Table of Contents

1. Introduction
    1.1 Origin and Goals
    1.2 Document Conventions
    1.3 Terminology
2. XLink Markup Design
    2.1 XLink Attribute Usage Patterns
    2.2 XLink Element Type Relationships
    2.3 Attribute Value Defaulting
    2.4 Integrating XLink Usage with Other Markup
    2.5 Using XLink with Legacy Markup
3. XLink Elements and Attributes
    3.1 Extended Links
        3.1.1 Local Resources for an Extended Link
        3.1.2 Remote Resources for an Extended Link
        3.1.3 Traversal Rules for an Extended Link
        3.1.4 Titles for Extended Links, Locators, and Arcs
        3.1.5 External Linksets for Resources Participating in Extended Links
    3.2 Simple Links
    3.3 Type Attribute
    3.4 Locator Attribute (href)
    3.5 Semantic Attributes (role and title)
    3.6 Behavior Attributes (show and actuate)
        3.6.1 show Attribute
        3.6.2 actuate Attribute
4. Processing and Conformance
    4.1 Processing Dependencies
    4.2 Markup Conformance
    4.3 Application Conformance

Appendices

A. References
B. Working Group Members and Acknowledgments

1. Introduction

This specification defines the XML Linking Language (XLink), which allows elements to be inserted into XML documents in order to create and describe links between resources. For the purposes of this specification, a link is a relationship between two or more resources or portions of resources, made explicit by an XLink linking element. Other kinds of links may exist and even be encoded in XML, but the term as used here refers only to an XLink link.

XLink provides a framework for creating both basic unidirectional links and more complex linking structures. It allows XML documents to:

An important application of XLink is in hypertext systems. Hyperlinks are links that are meaningful to end users, often being presented to them directly for use and actuation. This specification defines hypertext-specific metadata that can be associated with a link. XLink is also applicable to links that are entirely machine-processed.

A simple case of a hyperlink is an HTML A element, which has these characteristics:

This set of characteristics is powerful, but the model that underlies them limits the range of possible hyperlink functionality. The model defined in this specification shares with HTML the use of URI technology, but goes beyond HTML in offering features, previously available only in dedicated hypermedia systems, that make hyperlinking more scalable and flexible. Along with providing linking data structures, XLink provides a minimal link behavior model; higher-level applications layered on XLink may need to specify alternate or more sophisticated rendering and processing treatments.

Integrated treatment of specialized links used in other technical domains, such as foreign keys in relational databases and reference values in programming languages, is out of the scope of this specification.

1.1 Origin and Goals

The design of XLink has been informed by knowledge of established hypermedia systems and standards. The following standards have been especially influential:

  • HTML: Defines several element types that represent links.
  • HyTime: Defines inline and out-of-line link structures and some semantic features, including traversal control and presentation of objects.
  • Text Encoding Initiative Guidelines (TEI P3): Provides structures for creating links, aggregate objects, and link collections out of them.

Many other linking systems, such as Dexter, FRESS, MicroCosm, and InterMedia, have also informed the design of XLink.

See the XLink Requirements Document [XLREQ] for a thorough explanation of requirements for the design of XLink.

1.2 Document Conventions

XLink has adopted the following conventions for non-normative commentary:

Note:

General comments the editors wish to call to the attention of the reader.

1.3 Terminology

The key words "must," "must not," "required," "shall," "shall not," "should," "should not," "recommended," "may," and "optional" in this document are to be interpreted as described in [IETF RFC 2119].

The following special terms are used in this specification. Additional terms are defined in the flow of the text.

[Definition: ] application

An XLink application is any software module that interprets XML documents containing XLink links or documents that participate in a link. This specification defines conformance requirements for XLink applications.

[Definition: ] arc

A specification of link traversal rules, including information about the direction and also possibly the context of traversal.

[Definition: ] ending resource

A resource or sub-resource in the "to" position of a pair of participating resources, as specified or implied by a link's arcs. Depending on the characteristics of the link, it consists of one of the following:

  • A resource-type element
  • The resource addressed in a locator-type element
  • The resource addressed in a simple-type element
[Definition: ] hyperlink

An explicit relationship between two or more resources or portions of resources with an eye to presentation and traversal in user interfaces.

[Definition: ] inline link

A link where some content in the linking element serves, by virtue of its presence inside the linking element, as a participating resource. HTML A, HyTime clink, and TEI XREF are all inline links.

[Definition: ] link

A relationship between resources or portions of resources, encoded as an XLink linking element.

[Definition: ] linking element

An XLink element that asserts the existence and describes the characteristics of a link.

[Definition: ] local resource

Document content that becomes a participating resource of a linking element by virtue of being inside (or being itself) a linking element.

[Definition: ] locator

Data that identifies, by address or identifier, a remote resource that is participating in the link.

[Definition: ] multidirectional link

A link whose traversal can be initiated from more than one of its participating resources. Note that being able to "go back" after traversing a one-directional link does not make the link multidirectional.

[Definition: ] out-of-line link

A link whose only participating resources are remote. Out-of-line links are required for allowing traversal to be initiated from a resource to which the link creator does not have write access.

[Definition: ] participating resource

A resource that takes part in a link. All resources are potential contributors to a link; participating resources are the actual contributors to a particular link.

[Definition: ] remote resource

Any participating resource of a link that is pointed to explicitly with a locator.

[Definition: ] resource

An addressable unit of information or service. Examples include files, images, documents, programs, and query results. XLink allows for the association of resources and portions of resources by means of links. Note that this term and its definition are taken from the basic specifications governing the World Wide Web, such as IETF RFCs [IETF RFC 2396], [IETF RFC 1738] and [IETF RFC 1808].

[Definition: ] starting resource

A resource or sub-resource in the "from" position of a pair of participating resources, as specified or implied by a link's arcs. Depending on the characteristics of the link, it consists of one of the following:

  • A resource-type element
  • The resource addressed in a locator-type element
  • A simple-type element
[Definition: ] sub-resource

A portion of a resource, pointed to as the precise destination of a link. For example, if the whole resource is an XML document, the sub-resource might be a particular element inside the document. Traversal might result in highlighting that element, scrolling to that point in the document, embedding that element in the display of the starting resource, etc.

[Definition: ] traversal

The action of using a link; that is, of accessing a resource. Traversal may be initiated by a user action (for example, clicking on a local resource of an inline linking element) or may occur under program control.

[Definition: ] URI-reference

An optional URI ([IETF RFC 2396], [IETF RFC 1738] and [IETF RFC 1808]) as interpreted through XML Base [XBASE], with an optional fragment identifier separated from the URI by a crosshatch ("#") character. Either the URI or the fragment identifier or both must be present. URI stands for Uniform Resource Identifier.

2. XLink Markup Design

The existence of a link is asserted by an XLink linking element. Linking elements must be recognized reliably by applications in order to provide appropriate display or other behavior. XLink uses the mechanism described in the Namespaces Recommendation [XNAME] to accomplish link recognition.

The XLink namespace defined by this specification has the following URI:

http://www.w3.org/1999/xlink

As dictated by the Namespaces Recommendation, the use of XLink elements and attributes requires declaration of the XLink namespace. For example, the following declaration would make the prefix xlink available within the myElement element to represent the XLink namespace:

<myElement
  xmlns:xlink="http://www.w3.org/1999/xlink">
  ...
</myElement>

For convenience in this specification, the xlink prefix is used in code examples to stand for the declaration of the XLink namespace on some element in whose scope the so-marked attribute appears, whether or not an XLink namespace declaration is present in the example.

XLink's namespace provides global attributes that can be used on elements that are in any arbitrary namespace. The global attributes are type, href, role, title, show, actuate, from, and to. Document creators can use the XLink global attributes to make the elements in their own namespace, or even in a namespace they don't control, recognizable as XLink elements. The XLink attribute type indicates the XLink element type (simple, extended, locator, arc, resource, or title); the type dictates the constraints such an element must follow and the behavior of XLink-conforming applications on encountering the element.

Following is an example of a crossReference element from a non-XLink namespace that has XLink global attributes:

<my:crossReference
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:my="http://me.com/"
  xlink:type="simple"
  xlink:href="students.xml"
  xlink:role="studentlist" xlink:title="Student List"
  xlink:show="new" xlink:actuate="onRequest">
Current List of Students
</my:crossReference>

Using global attributes always requires the use of namespace prefixes on the individual attributes and the use of the type attribute on the element.

2.1 XLink Attribute Usage Patterns

While the XLink attributes are considered global by virtue of their use of the namespace mechanism, their allowed combinations on any one XLink element type depend greatly on the value of the special type attribute (see Type Attribute for more information) for the element on which they appear. The conformance constraint notes in this specification detail their allowed usage patterns. Following is a summary of the element types (columns) on which the global attributes (rows) are allowed, with an indication of whether a value is required (R) or optional (O):

simple extended locator arc resource title
type R R R R R R
href O R
role O O O O O
title O O O O O
show O O
actuate O O
from O
to O

This specification uses the convention "xxx-type element" to refer to elements that must adhere to a named set of constraints associated with an XLink element type, no matter what name the element actually has. For example, "locator-type element" would refer to all of the following elements:

<locator xlink:type="locator" ... />
<loc xlink:type="locator" ... />
<my:pointer xlink:type="locator" ... />

2.2 XLink Element Type Relationships

Various XLink element types have special meanings dictated by this specification when they appear as direct children of other XLink element types. Following is a summary of the child element types that play a significant role in particular parent element types. (Other combinations have no XLink-dictated significance.)

Parent type Significant child types
simple none
extended locator, arc, resource, title
locator title
arc title
resource none
title none

2.3 Attribute Value Defaulting

Using XLink potentially involves using a large number of attributes for supplying important link information. In cases where the values of the desired XLink attributes are unchanging across individual instances in all the documents of a certain type, attribute value defaults (fixed or not) can be added to a DTD so that the attributes do not have to appear physically on element start-tags. For example, if attribute defaults were provided for the xmlns:xlink, xmlns:my, type, show, and actuate attributes in the example in XLink Markup Design, the example would look as follows:

<my:crossReference
  xlink:href="students.xml"
  xlink:role="studentlist"
  xlink:title="Student List">
Current List of Students
</my:crossReference>

2.4 Integrating XLink Usage with Other Markup

This specification defines only attributes and attribute values in the XLink namespace. There is no restriction on using non-XLink attributes alongside XLink attributes. In addition, most XLink attributes are optional and the choice of simple or extended link is up to the markup designer or document creator, so a DTD that uses XLink features need not use or declare the entire set of XLink's attributes. Finally, while this specification identifies the minimum constraints on XLink markup, DTDs that use XLink are free to tighten these constraints. The use of XLink does not absolve a valid document from conforming to the constraints expressed in its governing DTD.

Following is an example of crossReference element with both XLink and non-XLink attributes:

<my:crossReference
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:my="http://me.com/"
  xlink:type="simple"
  xlink:href="students.xml"
  my:lastEdited="2000-06-10">
Current List of Students
</my:crossReference>

2.5 Using XLink with Legacy Markup

Because XLink's global attributes require the use of namespace prefixes, non-XLink-based links in legacy documents cannot be made into compliant XLink constructs as they stand, even if attribute value defaulting is used.

For example, XHTML 1.0 has an a element with an href attribute, but because the attribute is a local one attached to the a element in the XHTML namespace, it is not the same as an xlink:href global attribute in the XLink namespace.

Designers of XML markup languages that define linking constructs may wish to issue new versions that take advantage of XLink, which will necessitate modification of legacy documents.

3. XLink Elements and Attributes

XLink offers two kinds of links.

Extended links

Extended links offer full XLink functionality, such as out-of-line links and links that have more than two participating resources. As a result, their structure can be fairly complex, including elements for pointing to remote resources, elements for containing local resources, and possibly also elements for specifying traversal rules and title elements for specifying human-readable labels for links and resources.

XLink defines a way to give an extended link special external linkset semantics. Linksets play a role in the processing of extended links.

Simple links

Simple links offer a short form for a common kind of link, the two-ended inline link (into which category HTML-style A and IMG links fall). Because simple links offer less functionality than extended links, they have no special internal structure.

While simple links are conceptually a subset of extended links, they are syntactically different. A simple link cannot be converted into an extended link through the changing of a single attribute value; several structural changes would be needed.

The following sections define the XLink elements and attributes. Where an attribute or a group of related attributes can appear on multiple element types, it is described in its own section.

3.1 Extended Links

[Definition: ] An extended link is a link that associates an arbitrary number of resources. The participating resources may be any combination of remote and local. If all the resources are remote, the link is out of line. If any of the resources are local, then the link is inline.

The only kind of XLink that can be out of line is an extended link. Typically, extended linking elements are stored separately from the resources they associate (for example, in an entirely different document). Thus, the out-of-line characteristic is useful for situations where the participating resources are read-only, or where it is expensive to modify and update them but inexpensive to modify and update a separate linking element, or where the resources are in formats with no native support for embedded links (such as most multimedia formats).

The following diagram shows an out-of-line extended link that associates five remote resources. This could represent, for example, information about a student's course load: one resource being a description of the student, another being a description of the student's academic advisor, two resources representing courses that the student is attending, and the last resource representing a course that the student is auditing.

Stylized Diagram of Out-of-Line Extended Link

Without the extended link, the resources might have nothing to do with each other; for example, they might be in five separate documents. The lines emanating from the extended link represent the association it creates among the resources. However, notice that the lines do not have directionality. Without traversal rules being provided, the resources are associated in no particular order, with no implication as to whether and how individual resources are accessed.

The following diagram shows an inline extended link that associates five remote resources and one local resource (a special element inside the extended link element). This could represent the same sort of course-load example as described above, with the addition of the student's grade point average stored locally. Again, the lines represent mere association of the six resources, without traversal directions or behaviors implied.

Stylized Diagram of Inline Extended Link

The XLink element type for extended links is any element with an XLink-namespace attribute called type with a value of "extended".

The extended-type element contains a mixture of the following elements in any order, possibly along with other content and markup:

  • locator-type elements that address the remote resources participating in the link
  • arc-type elements that provide traversal rules among the link's participating resources
  • title-type elements that provide human-readable labels for the link
  • resource-type elements that supply local resources that participate in the link

It is not an error for an extended-type element to contain fewer than two locator- and/or resource-type elements. If the link has only one participating resource, or none at all, it is simply untraversable.

Subelements of the simple or extended type anywhere inside a parent extended-type element have no XLink-specified relationship to the parent link. Subelements of the locator, arc, or resource type that are not direct children of an extended-type element have no XLink-specified relationship to the parent link.

The extended-type element can have the semantic attributes (see Semantic Attributes (role and title)). If present, they supply semantic information about the link as a whole. If other XLink attributes are present on the element, they have no XLink-specified relationship to the link. If both a title attribute and one or more title-type elements are present, they have no XLink-specified relationship; a higher-level application built on XLink will likely want to specify appropriate treatment in this case.

If the extended-type element directly contains one or more resource-type elements, the link is inline. If it does not, the link is out of line.

Following is a sample (non-normative) set of declarations for an extended-type element.

Note:

In this example, and in most of the examples of declarations in this specification, the role values have been defaulted in the DTD to be the same as the element names. This is done only to simplify presentation of the example. There is no constraint that this must be the case; the element name might differ from the role value, for example, when the name needs to be translated to a different language, or when the most convenient machine-readable role value is not suitable for use by human authors.

<!-- courseload = extended-type
     tooltip = title-type
     go = arc-type
     student, course, audit, advisor = locator-type
     gpa = resource-type
-->
<!ELEMENT courseload
  (tooltip*, (student|course|audit|advisor|go*), gpa)>
<!ATTLIST courseload
  xlink:type           (extended)   #FIXED "extended"
  xlink:role           NMTOKEN      #FIXED "courseload"
  xlink:title          CDATA        #IMPLIED
>

The following example shows how an XML document using these declarations might look:

<courseload
  xlink:title="Course Load for Pat Jones">

  <go xlink:from="gpa" xlink:to="course" />
  <go xlink:from="student" xlink:to="course" />
  <go xlink:from="student" xlink:to="audit" />
  <go xlink:from="student" xlink:to="advisor" />
  <student xlink:href="..." />
  <course xlink:href="..." />
  <course xlink:href="..." />
  <audit xlink:href="..." />
  <advisor xlink:href="..." />
  <gpa>3.5</gpa>
</courseload>

3.1.1 Local Resources for an Extended Link

An extended link indicates local resources that participate in it by means of special subelements that appear inside the extended link. If an extended link contains one or more local resources, then by definition the link is inline. An element is used to supply such a local resource; the entire element, together with all of its contents, makes up the resource.

The XLink element for local resources is any element with an XLink-namespace attribute called type with a value of "resource".

The resource-type element can have any content; whatever content is present has no XLink-specified relationship to the link. It is possible for a resource-type element to have no content; in cases where it serves as a starting resource expected to be traversed on request, interactive XLink applications will typically generate some content in order to give the user a way to initiate the traversal.

The resource-type element has the semantic attributes (see Semantic Attributes (role and title)). The semantic attributes describe the meaning of that resource in the context of the link.

Following is a sample (non-normative) set of declarations for a resource-type element:

<!-- gpa = resource-type -->
<!ELEMENT gpa ANY>
<!ATTLIST gpa
  xlink:type           (resource)   #FIXED "resource"
  xlink:role           NMTOKEN      #FIXED "gpa"
  xlink:title          CDATA        #IMPLIED
>

The following example shows how an XML document using these declarations might look:

<gpa>3.5</gpa>

3.1.2 Remote Resources for an Extended Link

An extended link indicates remote resources that participate in it by means of locator elements.

The XLink element for locators is any element with an XLink-namespace attribute called type with a value of "locator".

The locator-type element can have any content; other than title-type elements that are direct children (see Titles for Extended Links, Locators, and Arcs), whatever content is present has no XLink-specified relationship to the link. If a locator-type element contains nested XLink elements, such contained elements have no XLink-specified relationship to the parent link. If a locator-type element has anything other than an extended-type element for a parent, the locator-type element has no XLink-specified meaning.

The locator-type element has the locator attribute (see Locator Attribute (href)) and the semantic attributes (see Semantic Attributes (role and title)). The locator attribute provides a URI-reference that identifies a remote resource (or sub-resource), and the semantic attributes describe the meaning of that resource in the context of the link.

Constraint: Attributes on Locator Element

On a locator-type element, the locator attribute (href) must have a value supplied.

Note:

A locator-type element, by itself, does not constitute a link just because it has a locator (href) attribute; unlike a simple-type element, it does not create an XLink-governed association between itself and the referenced resource.

Following is a sample (non-normative) set of declarations for a locator-type element:

<!-- student, course, audit, advisor = locator-type -->
<!ELEMENT student EMPTY>
<!ATTLIST student
  xlink:type     (locator)       #FIXED "locator"
  xlink:href     CDATA           #REQUIRED
  xlink:role     NMTOKEN         #FIXED "student"
  xlink:title    CDATA           #IMPLIED
>
<!ELEMENT course EMPTY>
<!ATTLIST course
  xlink:type     (locator)       #FIXED "locator"
  xlink:href     CDATA           #REQUIRED
  xlink:role     NMTOKEN         #FIXED "course"
  xlink:title    CDATA           #IMPLIED
>
<!ELEMENT audit EMPTY>
<!ATTLIST audit
  xlink:type     (locator)       #FIXED "locator"
  xlink:href     CDATA           #REQUIRED
  xlink:role     NMTOKEN         #FIXED "audit"
  xlink:title    CDATA           #IMPLIED
>
<!ELEMENT advisor EMPTY>
<!ATTLIST advisor
  xlink:type     (locator)       #FIXED "locator"
  xlink:href     CDATA           #REQUIRED
  xlink:role     NMTOKEN         #FIXED "advisor"
  xlink:title    CDATA           #IMPLIED
>

The following example shows how an XML document using these declarations might look:

<student
  xlink:href="/students/patjones.xml"
  xlink:title="Pat Jones" />
<course
  xlink:href="/courses/cs101.xml"
  xlink:title="CompSci 101" />
<advisor
  xlink:href="/profs/jaysmith.xml"
  xlink:title="Dr. Jay Smith" />

3.1.3 Traversal Rules for an Extended Link

An extended link can indicate normative rules for traversing among its participating resources by means of a series of optional arc elements.

The XLink element for arcs is any element with an XLink-namespace attribute called type with a value of "arc".

The arc-type element can have any content; other than title-type elements that are direct children (see Titles for Extended Links, Locators, and Arcs), whatever content is present has no XLink-specified relationship to the link. If an arc-type element has anything other than an extended-type element for a parent, the arc-type element has no XLink-specified meaning.

The arc-type element has the traversal attributes (from and to), the behavior attributes (see Behavior Attributes (show and actuate) ), and the semantic attributes (see Semantic Attributes (role and title)).

The traversal attributes define the traversal semantics between pairs of resources, where the resources are identified by role value: The from attribute defines resources from which traversal can be initiated, that is, starting resources, while the to attribute defines resources that can be traversed to, that is, ending resources. The behavior attributes specify the desired behavior for XLink applications to use when traversing to the ending resource.

The semantic attributes describe the meaning of the resource being traversed to in the context of that arc. This may differ from the meaning of a resource when taken outside the context of the arc. For example, five resources may each represent a "person," but in the context of a particular arc direction, the target resource may be a "mother," and in the opposite direction, the target resource may be a "daughter."

When a single starting resource leads to several ending resources, traversal-request behavior is unconstrained by this specification, but one possibility for interactive applications could be a pop-up menu that displays the relevant arc or locator titles.

Constraint: from and to Values

If a value is supplied for a from or to attribute, it must correspond to the same namespace URI (if any) and local part of some role attribute on a locator- or resource-type element that appears as a direct child inside the same extended-type element as does the arc-type element.

The following diagram shows an out-of-line extended link that associates five remote resources and provides rules for traversal among them:

Stylized Diagram of Out-of-Link Extended Link with Arcs

The diagram shows directional traversal arcs reflecting the following settings, where both As and Cs are allowed to initiate traversal to all Bs:

<!-- go = arc-type -->
<go xlink:from="A" xlink:to="B" />
<go xlink:from="C" xlink:to="B" />

As another example, assume an extended link that contains five locators, two with role values of "parent" and three with role values of "child" (titles are provided for convenience of reference):

<!-- extendedlink = extended-type
     loc = locator-type
-->
<extendedlink>
  <loc xlink:href="..." xlink:role="parent" xlink:title="p1" />
  <loc xlink:href="..." xlink:role="parent" xlink:title="p2" />
  <loc xlink:href="..." xlink:role="child"  xlink:title="c1" />
  <loc xlink:href="..." xlink:role="child"  xlink:title="c2" />
  <loc xlink:href="..." xlink:role="child"  xlink:title="c3" />
... <!-- arc-type elements would go here -->
</extendedlink>

The following specifies traversal from parent resources to child resources, which includes all of p1-c1, p1-c2, p1-c3, p2-c1, p2-c2, and p2-c3:

<!-- go = arc-type -->
<go xlink:from="parent" xlink:to="child" />

If no value is supplied for a from or to attribute, the missing value is interpreted as standing for all the roles supplied on locator-type elements in that extended-type element. For example, the following specifies traversal from parents to children and also from children to children, which includes all of p1-c1, p1-c2, p1-c3, p2-c1, p2-c2, p2-c3, c1-c1, c1-c2, c1-c3, c2-c1, c2-c2, c2-c3, c3-c1, c3-c2, and c3-c3:

<!-- go = arc-type -->
<go xlink:to="child" />

In this case, note that the traversal rules include arcs from some resources to other resources with the same role (from children to other children), as well as from some resources to themselves (from a child to itself); this is not an error.

If no arc-type elements are provided in an extended link, then by extension the missing from and to values are interpreted as standing for all the roles in that link. This would be equivalent to the following traversal specification:

<!-- go = arc-type -->
<go />

In the parent-child example, more than one locator has the same role. In such cases, the set of locators with the same role are to be understood as individual locators, rather than as referring to an aggregate resource; the traversal behavior of such a link might be the same as for a link where all the locators have different roles and the appropriate arcs are specified to produce the identical traversal pairs.

If the arc traversal rules for an extended link leave out any possible traversal pairs, these pairs must not be traversed.

Constraint: No Arc Duplication

In any one extended link, no two arc-type elements may have from and to values that have identical namespace URIs (if any) and local parts.

Following is a sample (non-normative) set of declarations for an arc-type element:

<!-- go = arc-type -->
<!ELEMENT go ANY>
<!ATTLIST go
  xlink:type    (arc)                #FIXED "arc"
  xlink:from    NMTOKEN              #IMPLIED
  xlink:to      NMTOKEN              #IMPLIED
  xlink:show    (new
                |replace
                |embed
                |undefined)          #IMPLIED
  xlink:actuate (onLoad
                |onRequest
                |undefined)          #IMPLIED
  xlink:role    NMTOKEN              #IMPLIED
  xlink:title   CDATA                #IMPLIED
>

The following example shows how an XML document using these declarations might look:

<go
  xlink:from="student"
  xlink:to="advisor"
  xlink:show="new"
  xlink:actuate="onRequest" />

3.1.4 Titles for Extended Links, Locators, and Arcs

The extended-, locator-, and arc-type elements can have the title attribute (more about which see Semantic Attributes (role and title)). However, they can also have a series of one or more title-type elements. Such elements are useful, for example, for cases where human-readable label information needs further element markup, or where multiple titles are necessary for internationalization purposes.

The XLink element for titles is any element with an XLink-namespace attribute called type with a value of "title".

The title-type element can have any content. If a title-type element contains nested XLink elements, such contained elements have no XLink-specified relationship to the parent link containing the title. If a title-type element has anything other than an extended-, locator-, or arc-type element for a parent, the title-type element has no XLink-specified meaning.

Following is a sample (non-normative) set of declarations for a title-type element:

<!-- advisorname = title-type -->
<!ELEMENT advisorname (name)>
<!ATTLIST advisorname
  xlink:type     (title)         #FIXED "title"
  xml:lang        CDATA          #IMPLIED
>

The following example shows how an XML document using these declarations might look:

<!-- advisor = locator-type
     advisorname = title-type
-->
<advisor xlink:href="profs/jaysmith.xml">
  <advisorname xml:lang="en">
    <name>
      <honorific>Dr.</honorific>
      <given>Jay</given>
      <family>Smith</family>
    </name>
  </advisorname>
</advisor>

3.1.5 External Linksets for Resources Participating in Extended Links

For an XLink application to traverse from a starting resource to an ending resource, it needs to locate both the starting resource and the link. Locating the two pieces is not a problem in the case of simple links, because the starting resource is the linking element itself; similarly for extended links whose starting resource of interest is local and thus contained inside the linking element. However, when a starting resource in an extended link is remote, the XLink application needs to be able to find both pieces somehow.

An example is a set of extended links that associate words in text (one remote resource) with their definitions (another remote resource). In order for the system to load and display the document containing the special words in a way that offers traversal to the definitions (for example, by allowing users to click on an underlined word to pop up its definition), it needs to locate and use the extended links that contain the association.

[Definition: ] XML documents whose purpose is to contain extended links are called linkbases; they are often used to make link management easier. Ideally, in order for a remote starting resource to avoid dependencies on the location of any linkbases that point into it, there will be an out-of-band method of informing a system how to locate relevant linkbases. Such methods are outside the scope of this specification. However, in cases where an out-of-band method is not available, XLink provides an in-band way for a resource to identify the likely locations of linkbases whose extended link locators point into it, so that starting resources within the current document may be found.

[Definition: ] A list of references to potentially relevant linkbases is called an external linkset. The presence of an XLink-encoded external linkset anywhere inside an XML document alerts XLink applications that some of the document's content may serve as a starting resource according to extended links found in the referenced linkbases.

XLink external linksets are encoded as extended-type elements with a role attribute that has a special value of "prefix:external-linkset". The element must be in the scope of a namespace declaration that associates the chosen prefix with the XLink namespace. For example:

<!-- extendedlink = extended-type
     loc = locator-type
-->
<extendedlink
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xlink:role="xlink:external-linkset">
  <loc ... />
</extendedlink>

Constraint: Linkbases Must Be XML

Any linkbase identified in an external linkset must be an XML document.

XLink applications should process XLink-specified external linksets as follows (though, in some cases, users may need to suspend such processing). XLink applications may also use any other means to locate and process additional external linksets.

On finding an extended link with a role of prefix:external-linkset, the XLink application should access the link's participating resources and extract any extended links found inside them, for use in constructing traversal paths that involve the resource in which the external linkset was found. In the case that the extracted resource is a sub-resource of a complete XML document, only those extended links completely contained in the extracted portion should be made available.

The application interpreting the extended link may choose, in the case of [Definition: ] chained external linksets (that is, external linksets that refer to linkbases that themselves contain further linksets), to limit the number of steps processed in the chain.

An application should maintain a list of extended links retrieved as a result of external linkset processing, and should not retrieve duplicate resources or links in the case where a cyclic dependency exists between external linksets.

Following is a sample (non-normative) set of declarations for an external linkset:

<!-- xls = extended-type
     linkbase = locator-type
-->
<!ELEMENT xls (linkbase+)>
<!ATTLIST xls
  xlink:type   (extended)    #FIXED "extended"
  xlink:role   NMTOKEN       #FIXED "xlink:extended-linkset"
  xlink:title  CDATA         #IMPLIED
>

The following example shows how an XML document using these declarations might look; this would have the effect of including the external linksets defined by the extended links contained in the documents linkset1.xml, linkset2.xml, and linkset3.xml, as well as potentially including any other external linksets referenced from these documents:

<xls>
  <linkbase xlink:href="linkset1.xml" />
  <linkbase xlink:href="linkset2.xml" />
  <linkbase xlink:href="linkset3.xml" />
</xls>

3.2 Simple Links

[Definition: ] A simple link is a link that associates exactly two resources, one local and one remote. Because it involves a local resource, a simple link is always inline.

The purpose of a simple link is to be a convenient shorthand for the equivalent extended link. Because simple links have only one remote resource and hardwired traversal rules, a single simple link element combines the basic functions of a linking element, a locator element, and an arc element.

The following diagram shows the characteristics of a simple link; it associates one local and one remote resource, and implicitly provides a single traversal arc from the local resource to the remote one. This could represent, for example, the name of a student appearing in text which, when clicked, leads to information about the student.

Stylized Diagram of Simple Link

Conceptually, a simple link could be represented by an extended link defined in approximately the following way; however, note that this set of declarations is only for illustration, and is not meant as a rigorous definition.

<!-- extendedlink = extended-type
     loc = locator-type
     res = resource=type
     go = arc-type
-->
<!ELEMENT extendedlink (loc, go, res)>
<!ATTLIST extendedlink
  xlink:type     (extended)            #FIXED "extended"
>

<!ELEMENT loc EMPTY>
<!ATTLIST loc

  xlink:type     (locator)             #FIXED "locator"
  xlink:href     CDATA                 #IMPLIED
  xlink:role     (remote)              #FIXED "remote"
  xlink:title    CDATA                 #IMPLIED

<!ELEMENT go EMPTY>
<!ATTLIST go
  xlink:from    (local)                #FIXED "local"
  xlink:to      (remote)               #FIXED "remote"
  xlink:show    (new
                |replace
                |embed
                |undefined)          #IMPLIED
  xlink:actuate (onLoad
                |onRequest
                |undefined)          #IMPLIED
>
<!ELEMENT res ANY>
<!ATTLIST res
  xlink:role    (local)                #FIXED "local"
>
...
<extendedlink>
  <loc xlink:href="..." />
  <go />
  <res>click here</res>
</extendedlink>

Instead, the XLink simple linking element can be used, where all these elements, their attributes, and their fixed attribute value settings are conceptually combined into a single element. The XLink element for simple links is any element with an XLink-namespace attribute called type with a value of "simple". The simple equivalent of the above extended link would be as follows:

<simplelink xlink:href="...">click here</simplelink>

The simple-type element can have any content; the simple-type element itself, together with all of its content, is the local resource of the link, as if the element were a resource-type element. If a simple-type element contains nested XLink elements, such contained elements have no XLink-specified relationship to the parent link. It is possible for a simple-type element to have no content; in cases where the link is expected to be traversed on request, interactive XLink applications will typically generate some content in order to give the user a way to initiate the traversal.

The simple-type element combines attributes from other XLink elements in the following way: It takes the locator attribute (see Locator Attribute (href)) and the semantic attributes (see Semantic Attributes (role and title)) from the locator-type element, and the behavior attributes (see Behavior Attributes (show and actuate) ) from the arc-type element. Thus, the semantic attributes describe the function of the single remote resource in the context of the link, and the behavior attributes specify the desired behavior for XLink applications to use when traversing from the local resource to the remote resource. Simple links do not have the ability to specify semantic attributes for the link itself, for the local resource, or for the single arc.

It is not an error for a simple-type element to have no locator (href) attribute value. If a value is not provided, the link is simply untraversable.

Following is a sample (non-normative) set of declarations for a simple-type element:

<!-- studentlink = simple-type -->
<!ELEMENT studentlink ANY>
<!ATTLIST studentlink
  xlink:type    (simple)             #FIXED "simple"
  xlink:href    CDATA                #IMPLIED
  xlink:role    NMTOKEN              #FIXED "student"
  xlink:title   CDATA                #IMPLIED
  xlink:show    (new
                |replace
                |embed
                |undefined)          #FIXED "replace"
  xlink:actuate (onLoad
                |onRequest
                |undefined)          #FIXED "onRequest"
>

The following example shows how an XML document using these declarations might look:

...
<studentlink
  xlink:href="/students/patjones.xml"
  xlink:title="Info about Pat Jones">Pat</studentlink> is popular around
the student union.
...

3.3 Type Attribute

The attribute that identifies XLink element types is type.

Constraint: type Value

The value of the type attribute must be supplied either on the element start-tag or as an attribute value default (discussed in Attribute Value Defaulting). The value must be one of "simple", "extended", "locator", "arc", "resource", "title", or "none".

When the value of the type attribute is none, the element has no XLink-specified meaning, and any XLink-related attributes or content has no XLink-specified relationship to the element.

Following is a sample (non-normative) attribute-list declaration for type on an element intended to be simple-type:

<!ATTLIST xlink:simple
  xlink:type   (simple)              #FIXED "simple"
  ...
>

For an element that serves as an XLink element only on some occasions, one declaration might be as follows, where the document creator sets the value to simple in some circumstances and none in others:

<!ATTLIST commandname
  xlink:type   (simple|none)        #REQUIRED
  xlink:href   CDATA                #IMPLIED
>

3.4 Locator Attribute (href)

The attribute that supplies the data that allows an XLink application to find a remote resource is href. It can be used on simple-type elements, and is required on locator-type elements.

The value of the href attribute must be a URI-reference as defined in [IETF RFC 2396]. However, because it is impractical for any application to check that a value is a URI-reference, this specification imposes no such conformance testing requirement on XLink applications.

The URI-reference must be receive XML Base [XBASE] processing before being traversed to.

For locators into XML resources, the format of the fragment identifier (if any) used within the URI-reference is specified by the XPointer specification [XPTR].

Following is a sample (non-normative) attribute-list declaration for href on an element intended to be simple-type:

<!ATTLIST simplelink
  xlink:href    CDATA           #REQUIRED
  ...
>

3.5 Semantic Attributes (role and title)

The attributes that describe the function of resources and traversal rules within the context of a link are role and title. They can be used on simple-, locator, resource-, and arc-type elements.

Constraint: role Value

If a value is supplied for a role attribute, it must be a QName (qualified name) as defined in the Namespaces Recommendation [XNAME]. The namespace associated with a role prefix must be declared on some element in whose scope the role attribute appears.

The role attribute is used to describe the function of a link's remote resource in a machine-readable fashion, and, in the case of extended-type elements, to serve as a resource category label for traversal rules in arc-type elements. The role attribute is not required to have a value; however, if a value is absent, traversal intentions cannot be supplied for its resource using arc-type elements. When no role value is supplied, no particular role value is to be inferred.

The following example shows role values and their corresponding namespace declarations in an extended-type element:

<extendedlink
  xmlns:bib="http://www.somewhere.org">
  <loc
    xlink:role="bib:author"
    xlink:href="http://www.w3.org/works.xml" />
  <loc
    xlink:role="bib:publisher"
    xlink:href="http://www.w3.org/or.xml" />
  <loc
    xlink:role="n"
    xlink:href="http://www.w3.org/else.xml" />
  <loc
    xmlns:bib2="http://www.nowhere.org"
    xlink:role="bib2:docname"
    xlink:href="http://www.w3.org/crash.xml" />
</extendedlink>

The title attribute is used to describe the function of a link's remote resource in a human-readable fashion. (However, see also Titles for Extended Links, Locators, and Arcs.) It is not required, but if it is used, it should contain a string that describes the resource. The use of this information is highly dependent on the type of processing being done. It can be used, for example, to make titles available to applications used by visually impaired users, or to create a table of links, or to display them as help text that appears when a user lets a mouse pointer hover over a starting resource.

Following is a sample (non-normative) attribute-list declaration for role and title on an element intended to be simple-type:

<!ATTLIST simplelink
  ...
  xlink:role    NMTOKEN                #IMPLIED
  xlink:title   CDATA                  #IMPLIED
  ...
>

3.6 Behavior Attributes (show and actuate)

The behavior attributes are show and actuate. They can be used on the simple- and arc-type elements. When used on a simple-type element, they signal behavior intentions for traversal to that link's single remote ending resource. When they are used on an arc-type element, they signal behavior intentions for traversal to whatever ending resources (local or remote) are specified by that arc.

The show and actuate attributes are not required. When they are used, conforming XLink applications should give them the treatment specified in this section. There is no hard requirement ("must") for this treatment because what makes sense for an interactive application, such as a browser, is unlikely to make sense for a noninteractive application, such as a robot. However, all applications should take into account the full implications of ignoring the specified behavior before choosing a different course.

Following is a sample (non-normative) attribute-list declaration for show and actuate on a simple-type element:

<!-- simplelink = simple-type -->
<!ATTLIST simplelink
...
  xlink:show    (new
                |replace
                |embed
                |undefined)          #IMPLIED
  xlink:actuate (onLoad
                |onRequest
                |undefined)          #IMPLIED
...
>

Applications encountering arc-type elements in external linksets must treat the behavior attributes as if they were specified as show="undefined" and actuated="onLoad", even if other values were specified.

3.6.1 show Attribute

The show attribute is used to communicate the desired display of the ending resource on traversal from the starting resource. XLink applications must recognize the following values for the show attribute: "new", "replace", "embed", and "undefined". Other values are permissible; their behavior may be dictated by higher-level application specifications. If an application encounters a value of the show attribute that it does not recognize, or the absence of a value, it must treat it the same as the value "undefined".

Constraint: show Value

If a value is supplied for a show attribute, it must be a QName (qualified name) as defined in the Namespaces Recommendation [XNAME]. If the value does not have a prefix, it must be one of the values "new", "replace", "embed", and "undefined"; all other unprefixed values are reserved by this specification for future use. The namespace associated with a show prefix must be declared on some element in whose scope the show attribute appears. The prefix used must not correspond to the XLink namespace.

Conforming XLink applications should apply the following treatment for unprefixed show values:

new

An application traversing to the ending resource should load it for display in a new window, frame, pane, or other relevant display context. This is similar to the effect achieved by the following HTML fragment:

<A HREF="http://www.an.org" target="_blank">...</A>
replace

An application traversing to the ending resource should load the resource for display in the same window, frame, pane, or other relevant display context in which the starting resource was loaded for display. This is similar to the effect achieved by the following HTML fragment:

<A HREF="http://www.an.org" target="_self">...</A>
embed

An application traversing to the ending resource should load it for display in place of the starting resource. This is similar to the effect achieved by the following HTML fragment:

<IMG SRC="http://www.an.org/smiley.gif" ALT=":-)">

The starting resource is typically not an entire document; this would be the case only when the entire document consists of a simple link. Thus, embedding typically has an effect distinct from replacing.

Just as for the HTML IMG element, embedding affects only the display of the relevant resources; it does not dictate permanent transformation of the starting resource. For example, if the ending resource is XML, it is not parsed as if it were part of the starting resource.

undefined

The behavior of an application traversing to the ending resource is unconstrained by this specification. The application may use other cues, such as other markup present in the link or environment settings, to determine the appropriate behavior.

3.6.2 actuate Attribute

The actuate attribute is used to communicate the desired timing of traversal from the starting resource to the ending resource. XLink applications must recognize the following values for the actuate attribute: "onLoad", "onRequest", and "undefined". Other values are permissible; their behavior may be dictated by higher-level application specifications. If an application encounters a value of the actuate attribute that it does not recognize, or the absence of a value, it must treat it the same as the value "undefined".

Constraint: actuate Value

If a value is supplied for an actuate attribute, it must be a QName (qualified name) as defined in the Namespaces Recommendation [XNAME]. If the value does not have a prefix, it must be one of the values "onLoad", "onRequest", and "undefined"; all other unprefixed values are reserved by this specification for future use. The namespace associated with an actuate prefix must be declared on some element in whose scope the actuate attribute appears. The prefix used must not correspond to the XLink namespace.

Conforming XLink applications should apply the following treatment for show values:

onLoad

An application should traverse to the ending resource immediately on loading the starting resource. This is similar to the effect typically achieved by the following HTML fragment, when the user agent is configured to display images:

<IMG SRC="http://www.an.org/smiley.gif" ALT=":-)">
onRequest

An application should traverse from the starting resource to the ending resource only on a post-loading event triggered for the purpose of traversal. An example of such an event might be when a user clicks on the display of the starting resource, or a software module finishes a countdown that precedes a redirect.

undefined

The behavior of an application traversing to the ending resource is unconstrained by this specification. The application may use other cues, such as other markup present in the link or environment settings, to determine the appropriate behavior.

4. Processing and Conformance

This section details processing and conformance requirements.

4.1 Processing Dependencies

XLink depends on XML, XML Namespaces, and XML Base.

4.2 Markup Conformance

An XML element is XLink-conforming if it:

  1. has a type attribute from the XLink namespace whose value is one of "simple", "extended", "locator", "arc", "resource", "title", or "none", and
  2. adheres to the conformance constraints imposed by the chosen XLink element type, as prescribed in this specification.

This specification imposes no particular constraints on DTDs; conformance applies only to elements and attributes.

4.3 Application Conformance

An application is XLink-conforming if it:

  1. supports XML 1.0, XML Namespaces, and XML Base, and
  2. observes the mandatory conditions ("must") set forth in this specification, and
  3. for any optional conditions ("should" and "may") it chooses to observe, observes them in the way prescribed, and
  4. performs markup conformance testing according to all the conformance constraints appearing in this specification.

Appendices

A. References

CHUM
Steven J. DeRose and David G. Durand. 1995. "The TEI Hypertext Guidelines." In Computing and the Humanities 29(3). Reprinted in Text Encoding Initiative: Background and Context, ed. Nancy Ide and Jean Ronis, ISBN 0-7923-3704-2.
DOM
Vidur Apparao et al. DOM (Document Object Model) Level 1.Document Object Model (DOM) Level 1 Specification. 1998. (See http://www.w3.org/TR/REC-DOM-Level-1/
).
IETF RFC 1738
IETF (Internet Engineering Task Force). RFC 1738: Uniform Resource Locators. 1991. (See http://www.w3.org/Addressing/rfc1738.txt
).
IETF RFC 1808
IETF (Internet Engineering Task Force). RFC 1808: Relative Uniform Resource Locators. 1995. (See http://www.w3.org/Addressing/rfc1808.txt
).
IETF RFC 2119
S. Bradner, editor. Key words for use in RFCs to Indicate Requirement Levels. March 1997. (See http://www.ietf.org/rfc/rfc2119.txt
.)
IETF RFC 2396
IETF (Internet Engineering Task Force). RFC 2396: Uniform Resource Identifiers. 1995. (See http://www.ics.uci.edu/pub/ietf/uri/rfc2396.txt
).
ISO/IEC 10744
ISO (International Organization for Standardization). ISO/IEC 10744-1992 (E). Information technology-Hypermedia/Time-based Structuring Language (HyTime). [Geneva]: International Organization for Standardization, 1992. Extended FacilitiesAnnex. [Geneva]: International Organization for Standardization, 1996. (See http://www.ornl.gov/sgml/wg8/docs/n1920/
).
RDF
Ora Lassila and Ralph Swick, editors. Resource Description Framework (RDF) Model and Syntax Specification. World Wide Web Consortium, 1999. (See http://www.w3.org/TR/REC-rdf-syntax
.)
TEI
C. M. Sperberg-McQueen and Lou Burnard, editors.Guidelines for Electronic Text Encoding and Interchange. Association for Computers and the Humanities (ACH), Association for Computational Linguistics (ACL), and Association for Literary and Linguistic Computing (ALLC). Chicago, Oxford: Text Encoding Initiative, 1994.
XBASE
Jonathan Marsh, editor. XML Base (XBase). World Wide Web Consortium, 1999. (See http://www.w3.org/TR/xmlbase
.)
XIS
John Cowan and David Megginson, editors. XML Information Set. World Wide Web Consortium, 1999. (See http://www.w3.org/TR/xml-infoset
.)
XLDP
Eve Maler and Steve DeRose, editors. XML Linking Language (XLink) Design Principles. Seekonk: World Wide Web Consortium, 1998. (See http://www.w3.org/TR/NOTE-xlink-principles
.)
XLREQ
Steven DeRose, editor. XML XLink Requirements Version 1.0. Brown University. Seekonk: World Wide Web Consortium, 1999. (See http://www.w3.org/TR/NOTE-xlink-req
.)
XNAME
Tim Bray, Dave Hollander, and Andrew Layman, editors. Namespaces in XML. Textuality, Hewlett-Packard, and Microsoft. World Wide Web Consortium, 1999. (See http://www.w3.org/TR/REC-xml-names/
.)
XPTR
Ron Daniel, Steve DeRose, and Eve Maler, editors. XML Pointer Language (XPointer) V1.0. Metacode Technologies, Brown University, and Sun Microsystems. Burlington, Seekonk, et al.: World Wide Web Consortium, 1998. (See http://www.w3.org/TR/xptr
.)

B. Working Group Members and Acknowledgments

This specification was produced in the XML Linking Working Group, with the following members active at the completion of this specification:

The editors wish to acknowledge substantial contributions by Tim Bray, who served as co-editor on early Working Drafts. We would also like to acknowledge important contributions from Gabe Beged-Dov, who wrote the XArc proposal. Finally, we would like to thank the XML Linking Interest Group and Working Group for their support and input.