W3C Logo

XML Linking Language (XLink)

W3C Working Draft 20-December-1999

This version:
http://www.w3.org/TR/1999/WD-xlink-19991220
Latest version:
http://www.w3.org/TR/xlink
Previous version(s):
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 comment on this 1999 December 20 XLink working draft, which it believes to be near completion. However, a few issues remain on which the Working Group seeks public feedback. A complete list of links to these issues is collected in Open Issues.

The W3C Membership and other interested parties are invited to review the specification and report first implementation experience. Please send comments to 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 which is expected to be used with XLink, see [XPTR].

See XML Linking Language (XLink) Design Principles 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 Element Method of Link Recognition
    2.2 Global Attribute Method of Link Recognition
    2.3 Attribute Value Defaulting
    2.4 Integrating XLink Usage with Other 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 Titles for an Extended Link and its Locators
        3.1.4 Traversal Rules for an Extended Link
        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)
4. XLink Processing and Conformance
    4.1 Requirements on XML Processors
    4.2 Conformance Requirements for XLink Elements
    4.3 Conformance Requirements for XLink Applications

Appendices

A. References
B. Examples
    A Simple Link
    B Extended Link
    C Link Transform
    D HTML IMG in XLink Syntax
C. XLink and RDF
D. Working Group Members and Acknowledgements
E. Open Issues

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 XLink purposes, a link is an explicit relationship between two or more resources or portions of resources.

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 activation. 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. On the other hand, the XLink model is intended to provide linking data structures, rather than a link rendering or behavioral system; higher-level applications layered on XLink are expected to specify their required rendering and processing treatments separately.

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 XLink Requirements Document [XLREQ] contains a thorough explanation of requirements for the design of XLink. The categories and general nature of the requirements are very briefly summarized here.

General user requirements

An XML link must be able to describe and relate one or more Internet resources and/or data portions within resources, where the link itself might serve as one of the resources involved. It must be possible for an XML link to address into read-only resources, and it must be possible to specify the types of destinations to which a link's ends can point. It must be possible to control directions of traversal.

Mechanical and syntactic requirements

Links must be specified in XML form. It must be possible to apply XML link semantics to existing documents by modifying the documents' DTDs only, requiring no modification to the document instances themselves.

Compatibility requirements

XLink addressing must use URIs. An XML link must provide a straightforward way of representing an HTML A or IMG link; automated translation of HTML links to XML links must be possible.

XLink is expected to be informed by knowledge of established hypermedia systems and standards.

The following standards have been especially influential:

  • HTML: Defines several SGML 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.

1.2 Document Conventions

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

Issue (dummy-issue):

A recorded issue and something on which the working group is seeking comment.

Ed. Note: Notes the editors wish to call to the attention of readers within the WG and IG. To be removed from the HTML version of the released working drafts and final recommendation but remains in the XML version.

Note:

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

1.3 Terminology

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

[Definition: ] arc

A symbolic representation of traversal semantics in links, especially the direction and context of traversal.

[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

Abstractly, a link which serves as one of its own resources. Concretely, a link where some content in the linking element serves by design as a participating resource. HTML A, HyTime clink, and TEI XREF are all inline links.

[Definition: ] link

An explicit relationship between two or more resources or portions of resources.

[Definition: ] linking element

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

[Definition: ] local resource

A resource of a linking element that, by design, comes from the linking element's own content, making the link inline. Note that the content inside the linking element could instead be explicitly pointed to by means of a regular locator in the same linking element, in which case the resource is considered remote, not local.

[Definition: ] locator

Link data that identifies 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 following a one-directional link does not make the link multidirectional.

[Definition: ] out-of-line link

A link whose content does not by design serve as one of the link's participating resources. Such links presuppose a notion of external linksets, which instruct application software where to look for links. Out-of-line links are required for supporting multidirectional traversal and 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

In the abstract sense, an addressable unit of information or service that is participating in a link. Examples include files, images, documents, programs, and query results. Concretely, anything reachable by the use of a locator in some linking element. 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: ] sub-resource

A portion of a resource, pointed to as the precise destination of a link. As one example, a link might specify that an entire document be retrieved and displayed, but that some specific part or section of it is the specific linked data, to be treated in an application-appropriate manner such as indication by highlighting it or scrolling to that point.

[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 occur under program control.

[Definition: ] URI-reference

An optional URI [IETF RFC 2396], [IETF RFC 1738] and [IETF RFC 1808] 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 for the URI-reference to be valid. 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 application software 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/namespace/

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/namespace/">
  ...
</myElement>

Document creators can assign any prefix to their XLink elements, or use no prefix at all if default namespaces are used. However, 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 element or attribute appears, whether or not an XLink namespace declaration is present in the example.

The XLink namespace allows for flexibility in markup design by offering two methods for link recognition: elements and global attributes.

2.1 Element Method of Link Recognition

XLink's namespace provides element types that can be used directly in instances. The element types are simple, extended, locator, arc, resource, and title. Elements of these types must adhere to certain constraints on their content and attribute lists, and they require certain treatment by XLink implementations.

Document creators can use this method to quickly incorporate "standard linking elements" into their languages. Following is an example of an XLink simple element that can function as an HTML A-style link (if appropriate behavior is supplied by an application):
<xlink:simple
  xmlns:xlink="http://www.w3.org/1999/xlink/namespace/"
  href="students.xml"
  role="studentlist"
  title="Student List"
  show="replace"
  actuate="onRequest">
Current List of Students
</xlink:simple>

2.2 Global Attribute Method of Link Recognition

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 global attribute method to make the elements in their own namespace, or even in a namespace they don't control, recognizable as XLink elements. The special attribute type indicates the XLink element type (simple, extended, locator, arc, resource, or title) that dictates the constraints such an element must follow, even though the element is not literally a simple, extended, locator, arc, resource, or title element.

Following is an example of a HTML-style A element, that is, a non-XLink element, with XLink global attributes (note that appropriate behavior would have to be supplied by an application):

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

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

While the XLink attributes are considered "global" by virtue of their use of the namespace mechanism, their allowed combinations on any one element 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 brief summary of the element types (columns) on which the global attributes (rows) are allowed:

simple extended locator arc resource title
type X X X X X X
href X X
role X X X X
title X X X X
show X X X
actuate X X X
from X
to X
Example

For convenience in defining allowed element and attribute usage patterns, this specification uses the convention "xxx-type element" to refer to elements that must adhere to a named set of constraints associated with a category of XLink element, whether the element that appears in a document is actually called xxx or whether it simply has a type attribute whose value is "xxx". For example, "locator-type element" refers to both of the following constructs:

<!-- Literally uses the "locator" element type -->
<xlink:locator ... />

<!-- Uses the "type" attribute instead -->
<arbitraryElement xlink:type="locator" ... />

2.3 Attribute Value Defaulting

While few of the XLink attributes are required to be present, both of the link recognition methods potentially involve 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's external subset so that the attributes do not have to appear physically in the document. For example, if attribute defaults were provided for the xmlns:xlink, type, show, and actuate attributes in the example in Global Attribute Method of Link Recognition, and if the document had a DOCTYPE declaration that identified an external subset containing these default definitions, the example would look as follows:

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

2.4 Integrating XLink Usage with Other Markup

This specification defines only elements, attributes, and role values in the XLink namespace. There is no restriction on using non-XLink attributes alongside XLink attributes, nor is there any restriction on mixing non-XLink elements with XLink elements. 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 elements and 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 a HTML-style A element with both XLink and non-XLink attributes:

<A
 xlink:href="students.xml"
 NAME="ForFutureReference">
Current List of Students
</A>

3. XLink Elements and Attributes

XLink offers two kinds of links.

Extended links

Extended links offer full 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 at least locator elements for pointing to remote resources and possibly also arc 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 XLink-related internal structure.

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

Issue (link-events):

Should XLink provide a counterpart to the HTML attributes that permit script events to be attached to links? This issue is also related to the DOM work and the desire to provide a device-independent means of specifying and activating events. We are inclined to let this be part of the application semantics of a language at a higher layer than XLink.

3.1 Extended Links

[Definition: ] An extended link is a link that associates an arbitrary number of resources. All of its participating resources may be remote, in which case the link is out of line, or some of the link's own content can serve optionally as local resources, in which case 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 entirely separately from the resources they associate (for example, in a 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 the linking element itself, 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 is a description of the student, another is a description of the student's academic advisor, two resources represent courses that the student is attending, and the last resource represents a course that the student is auditing.

Stylized Diagram of Out-of-Line Extended Link

Notice that the lines that associate the resources do not have directionality; without traversal rules being provided, the five participating 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's content); this could represent the same sort of course-load example as described above, with the addition of the student's grade point average stored as a local resource.

Stylized Diagram of Inline Extended Link

The XLink extended linking element is called extended, or alternatively is an element in an arbitrary namespace 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

If an extended-type element directly or indirectly contains nested simple- or extended-type elements, or indirectly contains locator-, arc-, or resource-type elements, such contained elements have no XLink-specified relationship to the parent link.

Constraint: Locators in Extended Link Elements

The content of an extended-type element must contain at least one locator-type element.

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.

Note:

The attributes showdefault and actuatedefault have been removed from this draft. The rationale was that creating an attribute whose value gets inherited by the link's locators requires a level of processing that the Working Group did not feel comfortable specifying.

A sample set of declarations for an element called extended might look as follows:

<!-- Content model ensures at least one locator -->
<!ELEMENT xlink:extended
  (xlink:title*, xlink:arc*, xlink:locator,
(xlink:arc|xlink:locator)*, xlink:resource*)>
<!ATTLIST xlink:extended
  role           NMTOKEN         #IMPLIED
  title          CDATA           #IMPLIED
>

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

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

  <xlink:locator ... />
  <xlink:locator ... />
  <xlink:arc ... />

</xlink:extended>

A sample set of declarations for an element that uses the type attribute might look as follows:

<!-- Content model ensures at least one locator -->
<!ELEMENT courseload
  (tooltip*, go*, (student|course|audit|advisor),
(go|student|course|audit|advisor)*, 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">

  <student ... />
  <course ... />
  <course ... />
  <audit ... />
  <advisor ... />
  <gpa>...</gpa>
</courseload>

3.1.1 Local Resources for an Extended Link

If an extended link contains one or more local resources, then by definition the link is inline.

The XLink local resource element is called resource, or alternatively is an element in an arbitrary namespace 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.

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.

A sample set of declarations for an element called resource might look as follows:

<!ELEMENT xlink:resource ANY>
<!ATTLIST xlink:resource
  role           NMTOKEN         #IMPLIED
  title          CDATA           #IMPLIED
>

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

<xlink:resource>
...
</xlink:resource>

A sample set of declarations for an element that uses the type attribute might look as follows:

<!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>...</gpa>

3.1.2 Remote Resources for an Extended Link

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

The XLink locator element is called locator, or alternatively is an element in an arbitrary namespace with an XLink-namespace attribute called type with a value of "locator".

The locator-type element can have any content; whatever content is present has no XLink-specified relationship to the link. If a locator-type element directly or indirectly 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

A locator attribute value must be provided for a locator-type element.

A sample set of declarations for an element called locator might look as follows:

<!ELEMENT xlink:locator ANY>
<!ATTLIST xlink:locator
  href           CDATA           #REQUIRED
  role           NMTOKEN         #IMPLIED
  title          CDATA           #IMPLIED
>

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

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

A sample set of declarations for a series of elements that use the type attribute might look as follows:

<!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:role     NMTOKEN         #FIXED "course"
...
>
<!ELEMENT audit EMPTY>
<!ATTLIST audit
  xlink:type     (locator)       #FIXED "locator"
  xlink:role     NMTOKEN         #FIXED "audit"
...
>
<!ELEMENT advisor EMPTY>
<!ATTLIST advisor
  xlink:type     (locator)       #FIXED "locator"
  xlink:role     NMTOKEN         #FIXED "advisor"
...
>

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

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

3.1.3 Titles for an Extended Link and its Locators

Both extended- and locator-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, in the case where it is useful to put human-readable label information in an element (for example, so it can be further marked up), or where multiple titles are necessary (for example, for internationalization purposes).

The XLink title element is called locator, or alternatively is an element in an arbitrary namespace 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 directly or indirectly 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- or locator-type element for a parent, the title-type element has no XLink-specified meaning.

A sample set of declarations for an element called title might look as follows:

<!ELEMENT xlink:title ANY>
<!ATTLIST xlink:title
  xml:lang        CDATA          #IMPLIED
>

The following example shows how an XML document using these declarations might look (when used within a locator-type element):

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

A sample set of declarations for an element that uses the type attribute might look as follows:

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

The following example shows how an XML document using these declarations might look (when used within a locator-type element):

<advisor href="profs/jaysmith.xml">
<advisorname xml:lang="en">
<name>
<honorific>Dr.</honorific>
<given>Jay</given>
<family>Smith</family>
</name>
</advisorname>
</advisor>

3.1.4 Traversal Rules for an Extended Link

An extended link indicates the rules for traversing among its participating resources by means of a series of optional arc elements.

The XLink arc element is called arc, or alternatively is an element in an arbitrary namespace with an XLink-namespace attribute called type with a value of "arc".

The arc-type element can have any content; whatever content is present has no XLink-specified relationship to the link. If an arc-type element directly or indirectly contains nested XLink elements, such contained elements have no XLink-specified relationship to the parent 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) and the behavior attributes (see Behavior Attributes (show and actuate) ). 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, while the to attribute defines resources that can be traversed to. The behavior attributes specify the desired behavior for XLink implementations to use when traversing to the indicated to resource.

Constraint: from and to Values

If a value is supplied for a from or to attribute, it must correspond to the value of some role attribute on a locator-type element that appears directly 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

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

<xlink:arc from="A" to="B" />
<xlink:arc from="C" 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):

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

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:

<xlink:arc from="parent" 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:

<xlink:arc to="child" />

In this case, the traversal rules include arcs from some resources to themselves. Even if traversal rules are not explicitly provided for this situation, an arc from a resource to itself is always implicitly defined.

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:

<xlink:arc />

In both of the examples above, note that 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 an "aggregate resource"; the traversal behavior of such a link with is 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.

Constraint: No Arc Duplication

In any one extended link, no two arc-type elements may have identical from and to values.

A sample set of declarations for an element called arc might look as follows:

<!ELEMENT xlink:arc ANY>
<!ATTLIST xlink:arc
  from        NMTOKEN                #IMPLIED
  to          NMTOKEN                #IMPLIED
  show        (embed|new|replace)    #IMPLIED
  actuate     (onLoad|onRequest)     #IMPLIED
>

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

<xlink:arc
  from="student"
  to="essay"
  show="embed"
  actuate="onLoad" />

A sample set of declarations for an element that uses the type attribute might look as follows:

<!ELEMENT go ANY>
<!ATTLIST go
  xlink:type    (arc)                #FIXED "arc"
  xlink:from    NMTOKEN              #IMPLIED
  xlink:to      NMTOKEN              #IMPLIED
  xlink:show    (embed|new|replace)  #IMPLIED
  xlink:actuate (onLoad|onRequest)   #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" />

Issue (arc-semantics):

There are no role or title attributes on arc elements because we felt that the role of any arc is the concatenation of the two end roles, and if you're going to display title text for an end, there's no sensible place to display the title text for an arc in addition. However, in cases where the relationship between two elements has a role, then this mechanism does not hold. For example, a family may have many members, and the arc between a one person and another person could have a daughter role, whereas the arc in the opposite direction could have a mother role. Should we allow arc elements to have roles and titles?

3.1.5 External Linksets for Resources Participating in Extended Links

In order for an XLink implementation to initiate traversal from a remote resource identified in an extended link, it needs to be informed of the link's existence; otherwise the resource would just appear to be ordinary content that needs no link-related treatment. However, the extended link may be stored in a different document from the one containing the "starting point."

For example, if you have an out-of-line extended link that associates words in text with their definitions, in order for the document containing the word usages to offer the ability to traverse to the definitions (for example, by underlining the words and making them "clickable"), the system must somehow be able to locate and use the extended links that contain the association.

[Definition: ] Out-of-line links are commonly collected together into linkbases, XML documents whose primary purpose is to contain XLink extended link elements. Ideally, in order for the remote resource (the document containing the word usages, in our example) to avoid dependencies on the location of any linkbases that point into it, there will be an out-of-band way to inform a system how to locate relevant linkbases for any resource. However, in cases where this is not possible, XLink provides an in-band way for a resource to identify the likely locations of linkbases and other XML documents whose extended link locators point into it, so that "traversal initiation points" within the resource may be found. [Definition: ] A description of linkbases relevant to a particular resource is called an external linkset.

An external linkset is encoded as an extended-type element that has a role attribute with a 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:

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

Following is the expected normal behavior of an XLink implementation in processing specifications of external linksets. It is not intended to constrain XLink processing in XML editors or other applications where a user may need to suspend such processing. Nor is it intended to prevent the processing of additional external linksets under user control. For this reason, all of the processing-related text in this section reads should.

On finding an extended link with role xxx:external-linkset, an 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 "extraction resource" is a sub-resource of a complete document, only those extended links completely contained in the sub-resource should be made available. If any external linksets are made available to an application by out-of-band means, it should perform its typical external linkset processing on them as well.

Issue (require-xls-to-be-xml):

Is it possible, given the expectations of Web architecture, for us to make a conformance constraint requiring that resources identified as external linksets be of Internet media type */xml or some derivative?

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

Issue (step-control):

From Ben: Should control over accessing nested external linksets be brought up a level, so that the "XLink processor" (whether that's a UA or a server-side application, or perhaps has no interaction with the end user at all) rather than the application is the place where steps may be limited? In what sense is the "processor" different from the "application"?

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.

A sample set of declarations for an external linkset that uses an element called extended might look as follows:

<!ELEMENT xlink:extended (xlink:locator+)>
<!ATTLIST xlink:extended
  role   NMTOKEN             "xlink:extended-linkset"
  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 linkset defined by the extended links contained in the document mylinkset.xml, as well as including any other external linksets referenced from mylinkset.xml:

<xlink:extended>
  <xlink:locator href="mylinkset.xml" />
</xlink:extended>

A sample set of declarations for an external linkset that uses the type attribute (the typical case for this special use of extended links) might look as follows:

<!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:

<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 functions of a linking element, a locator element, and an arc element together.

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 that is linked 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 (note that this set of declarations is only for illustration, not as a rigorous definition):

<!ELEMENT xlink:extended
  (xlink:locator, xlink:resource, xlink:arc)>

<!ELEMENT xlink:locator EMPTY>
<!ATTLIST xlink:locator
  href         CDATA                 #REQUIRED
  role         (remote)              #FIXED "remote"
  title        CDATA                 #IMPLIED

<!ELEMENT xlink:resource ANY>
<!ATTLIST xlink:resource
  role        (local)                #FIXED "local"
>

<!ELEMENT xlink:arc EMPTY>
<!ATTLIST xlink:arc
  from        (local)                #FIXED "local"
  to          (remote)               #FIXED "remote"
  show        (embed|new|replace)    #IMPLIED
  actuate     (onLoad|onRequest)     #IMPLIED
>

Instead, the XLink simple linking element can be used, where all these elements and their attributes are combined into a single element. The element is called simple, or alternatively is an element in an arbitrary namespace with an XLink-namespace attribute called type with a value of "simple".

The simple-type element can have any content; all its content together is the local resource of the link, as if the content were inside a resource-type element. If a simple-type element directly or indirectly 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," an application will typically generate some content in order to give the user (or other agent) a way to initiate the traversal.

The simple-type element combines the functions of the 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 implementations to use when traversing from the local resource to the remote resource.

Constraint: Attributes on Simple Link Element

A locator attribute value must be provided for a simple-type element.

A sample set of declarations for an element called simple might look as follows:

<!ELEMENT xlink:simple ANY>
<!ATTLIST xlink:simple
  href        CDATA                  #REQUIRED
  role        NMTOKEN                #IMPLIED
  title       CDATA                  #IMPLIED
  show        (embed|new|replace)    #IMPLIED
  actuate     (onLoad|onRequest)     #IMPLIED
>

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

<xlink:simple
  href="/students/patjones.xml"
  role="student"
  title="Info about Pat Jones"
  show="replace"
  actuate="onRequest">Pat</xlink:simple> is popular around
the student union.

A sample set of declarations for an element that uses the type attribute might look as follows:

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

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

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

3.3 Type Attribute

The attribute that identifies non-XLink elements that should receive XLink treatment is type. It must be used on every element that does not have an XLink element type (simple, extended, locator, arc, resource, or title), but is intended to conform to the constraints imposed by these element types.

Constraint: type Attribute vs. Element Type

The type attribute cannot be used on an XLink simple, extended, locator, arc, resource, or title element. It can be used only on non-XLink elements.

The value of the type attribute can be inferred by applications, rather than be present directly in an XML document. This allows XLink-using languages to define element types that act as XLink linking elements in some circumstances (for example, only when some non-XLink attribute on the same element has a specific value filled in) and as non-XLink-related elements in others.

Constraint: type Value

The value of the type attribute, if supplied, must be one of simple, extended, locator, arc, resource, or title.

A sample attribute-list declaration for type on an XLink simple element might look as follows:

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

For an element that serves as an XLink element only under certain circumstances, one declaration might be as follows:

<!ATTLIST commandname
  xlink:type (simple)      #IMPLIED
>

Issue (not-an-xlink):

Would it be good practice to dictate an explicit value to use to indicate that the element is not an XLink element, e.g., “none” or something?

It would also be possible (if not advisable) to declare an element so broadly that it could serve as any kind of XLink element, depending on its contents and attribute settings. For example:

<!ATTLIST arbitrary-element
  xlink:type (simple
             |extended
             |locator
             |arc)         #IMPLIED
>

3.4 Locator Attribute (href)

The attribute that supplies a locator address or identifier for finding a remote resource is href. It must be used on simple- and locator-type elements.

Constraint: href Value

When the href attribute appears on a simple- or locator-type element, its value must be a URI-reference as defined in [IETF RFC 2396].

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].

A sample attribute-list declaration for href on an XLink simple element might look as follows:

<!ATTLIST simple
  href    CDATA           #REQUIRED
  ...
>

3.5 Semantic Attributes (role and title)

The attributes that describe the function of resources within the context of a link are role and title. They can be used on simple-, locator, and resource-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 given link's role prefix must be declared on some element in whose scope the role value appears.

Issue (resource-media-specification):

Should XLink develop its own an extensible repertoire of role types, with common semantics so that they can be recognized and acted upon appropriately by a variety of user agents? HTML 4.0 LINK, for instance, suggests a simple set of pre-defined names for PREV NEXT, TOC, etc. XLink could go beyond these simple conventions and provide a more formal set and mechanism. We are inclined, in general, to leave this to higher-level languages based on XLink.

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 element:

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

Issue (role-ns):

Does the Namespaces specification allow our creation of roles as a new “symbol space”? At the very least, does it not disallow it?

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 an Extended Link and its Locators.) 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.

A sample attribute-list declaration for role and title on an XLink simple element might look as follows:

<!ATTLIST simple
  role    NMTOKEN                #IMPLIED
  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.

Issue (display-centric):

The behavior attributes are clearly quite display-centric, despite our attempts to describe them as being more generic. Can we motivate them in a less display-centric way?

Constraint: show Value

If a value is supplied for a show attribute, it must be one of embed, new, or replace.

Constraint: actuate Value

If a value is supplied for an actuate attribute, it must be one of onLoad or onRequest.

The show and actuate attributes are not required. When they are used, they signal only intentions of the link creator, rather than instructions that XLink implementations are required to act on. Further, the behavior they describe is a simple and limited "starter set"; it is expected that applications layered on XLink will specify their own behavioral treatments and constraints, and in particular, if a layered application depends on XLink behavior attribute settings, it should explicitly define its processing model for these settings.

The show attribute is used to communicate the intention of the link's creator as to the context in which link traversal should be performed. The interpretation of this intention is highly dependent on the type of processing being done. The allowed attribute values signal the following intentions:

embed

The target of the link should be displayed if possible, in a fashion appropriate to its media type, between the display of the end of the resource where traversal was initiated and the display of the first content (if any) following the linking element, in a fashion similar to that typically used in processing the HTML IMG element.

Issue (embed-where):

From Steve: The instructions for where to embed a resource are not perfectly accurate -- there may be no next content; more important, there may be element and other boundaries in between, and this definition leaves it ambiguous on which side of them embed happens. We should explain that the scope of the source anchor matters: if you linked to a SEC, the embed happens at the Point (as defined now in XPointer) immediately following the SEC; if you linked to the range consisting of all the children of the SEC, you'd get the embed just inside the end of the SEC after the last child (you could also get that by XPointing [a new verb!] to that point explicitly). This would matter, for example, if elements were generating text before or after themselves for display, or leading/trailing vertical space, or if the user is supposed to follow the link and then be able to edit, or.... How can this description be made unambiguous?

new

The traversal should occur without affecting the resource from which traversal was initiated. For example, in a display environment, this could be implemented by displaying the targeted resource in a new window; this is similar to the effect achieved by the following HTML fragment:

<A HREF="http://www.w3.org" target="_new">...</A>
replace

The presentation of the resource containing the linking element should be entirely replaced by a presentation of the one being linked to. In a display environment, this could be implemented in a fashion similar to that typically used in processing HTML A elements, involving a complete re-write of the display. The replace option is the one most commonly seen on the World Wide Web, where the presentation of the document being linked from is entirely replaced by the presentation of the object being linked to.

Issue (what-to-replace):

From Steve: A real issue we never resolved is the distinction in embed/new/replace semantics; we've left the intermediate case unnamed, where you want the destination anchor to replace the source *anchor*, not the source *document*; this makes a smooth sequence of 'what to replace': nothing (embed), the anchor (currently unnamed), the subresource (replace), or the window (new). Some might want to add something for panes, but that seems overkill (and hard to define consistently). Should the intermediate case be named and defined?

The actuate attribute is used to communicate the intention of the link's creator as to when traversal of that link should occur. The allowed attribute values signal the following intentions:

onLoad

The link may be traversed when its existence is recognized by the XLink implementation.

Note:

This value was previously called "auto". It was changed to be more consistent with "onRequest".

onRequest

The link should not be traversed until such traversal is explicitly requested.

When the show and actuate attributes are used on a simple-type element, they signal behavior intentions for traversal to that link's single remote resource. When they are used on an arc-type element, they signal behavior intentions for traversal to the resources indicated by the to value (or its absence).

Useful analogy to behavior in HTML user agents can be made to illustrate the traversal behavior desired. For example, the following combination on a simple-type element in the HTML A style signals the intention that traversal behavior be initiated by user action (perhaps clicking on the element content) and that the target resource replace the resource containing the link in the display window:

<a
  xlink:type="simple"
  xlink:href="..."
  xlink:show="replace"
  xlink:actuate="onRequest">click here</a>

The following combination on a simple-type element in the HTML IMG style signals the intention that traversal behavior be initiated as soon as the link is recognized by an XLink implementation and that the target resource be embedded in the resource containing the link in the display window:

<img
  xlink:type="simple"
  xlink:href="..."
  xlink:show="embed"
  xlink:actuate="onLoad" />

A sample attribute-list declaration for show and actuate on an XLink simple element might look as follows:

<!ATTLIST simple
  show    (embed|new|replace)    #IMPLIED
  actuate (onLoad|onRequest)     #IMPLIED
>

4. XLink Processing and Conformance

The following sections detail requirements for processing and conformance.

4.1 Requirements on XML Processors

For XLinks to be processed by an XML processor, the processor must support XML 1.0 plus Namespaces.

4.2 Conformance Requirements for XLink Elements

An element conforms to XLink if:

  1. The element has either:

    • either the element type name simple, extended, locator, or arc, or
    • an xlink:type attribute whose value is one of "simple", "extended", "locator", or "arc",

    and

  2. the element and all of its attributes and content adhere to the conformance constraints imposed by the chosen XLink element type, as prescribed in this specification.

Note that conformance is assessed at the level of individual elements, rather than whole XML documents, because XLink and non-XLink linking mechanisms may be used side by side in any one document. Additionally, an XLink element may have non-XLink attributes and content.

4.3 Conformance Requirements for XLink Applications

XLink applications are required to interpret XLink-conforming elements according to all required semantics prescribed by this specification and, for any optional semantics it chooses to support, supports them in the way prescribed. A user agent application should (but is not required to) allow its users to exercise control over document refresh and redirection, especially arcs with actuate="onLoad" settings.

XLink applications are also required to perform markup conformance testing according to all the conformance constraints appearing in this specification. Lack of conformance in any area shall generate an error.

There are no conformance requirements for what an application is to do when it finds extended links in an external linkset's resources. A sample list of situations with unspecified results follows:

  • Duplicate IDs between in-line versus out-of-line links referenced in the external linkset
  • Circular and self-references in the external linksets

Appendices

A. References

CHUM
Steven J. DeRose and David G. Durand. 1995. "The TEI Hypertext Guidelines." In Computing and the Humanities29(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 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.
XIS
John Cowan and David Megginson, editors. XML Information Set. World Wide Web Consortium, 1999. (See http://www.w3.org/TR/xml-infoset
.)
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. Datafusion, Brown University, and Sun Microsystems. Burlington, Seekonk, et al.: World Wide Web Consortium, 1998. (See http://www.w3.org/TR/xptr
.)

B. Examples

Following are examples of using XLink.

A Simple Link

The following shows a simple link
<student id="Fred"
  xmlns:xlink="http://www.w3.org/1999/xlink/namespace/">
<name>Fred</name>
<teacher
  xlink:href="teachers.xml#Joe"
  xlink:show="embed" />
</student>

B Extended Link

The following shows an extended link with the from element within the current document.
<xlink:extended
  xmlns:xlink="http://www.w3.org/1999/xlink/namespace/">
  <xlink:locator href="#Fred" role="student" />
  <xlink:locator href="teachers.xml#Joe" role="teacher" />
  <xlink:arc from="student" to="teacher" show="embed" />
</xlink:extended>

<student id="Fred">
  <name>Fred</name>
</student>

C Link Transform

The following shows an XSLT stylesheet fragment that could be used to transform the simple link shown in Simple Link. This solution is not entirely generic; since the href attribute contains an XPointer, the transformation assumes that the targeted resource is of Internet media type */xml.

Ed. Note: Replace or augment this example with one that is truly generic, e.g., show embedding of an image?

<xsl:template match="*[@xlink:show='embed']
 xmlns:xlink="http://www.w3.org/1999/xlink/namespace/">
 <xsl:apply-templates select="document(@xlink:href)">
</xsl:template>

D HTML IMG in XLink Syntax

The following example demonstrates how a complex HTML IMG element might be represented in XLink.

Note:

This example was removed on request of the HTML WG. We hope to provide an example more in accordance with their planned XHTML design later.

Issue (behavior-ns):

An example previously appearing here implied that we have to leave the value space for show/actuate open (e.g., for values such as html:user2), and that they have to be QNames the same way the role value is. Is this acceptable? If so, the specification will require a bit of surgery to reflect this.

C. XLink and RDF

Following are examples of how to map XLink to Resource Description Framework [RDF], with graphical demonstrations of the semantics involved.

Note:

We have been told that the mappings shown here are slightly inaccurate. We will incorporate fixes as soon as we receive them. Also, the graphics are out of date with respect to the latest XLink syntax; this too will be fixed.

The first example shows how this simple link can be transformed into its RDF equivalent.

<sample xmlns:xlink="http://www.w3.org/namespace/xlink/1999/"
   xlink:href="target"
         xlink:type="simple"
         xlink:show="embed"
         xlink:actuate="onLoad"
         xlink:role="The link role"
         xlink:title="The link title">
         ...
</sample>

This simple link appears as follows in RDF syntax:

<sample>
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:xlink="http://www.w3.org/namespace/xlink/1999/">
 <rdf:Description about="#xpointer(../..)">
       <xlink:href rdf:resource="target"/>
       <xlink:type rdf:resource="xlink:simple"/>
       <xlink:show rdf:resource="xlink:embed"/>
       <xlink:actuate rdf:resource="xlink:onLoad"/>
       <xlink:role>The link role</xlink:role>
       <xlink:title>The link title</xlink:title>
    </rdf:Description>
  </rdf:RDF>
  ...
</sample>

This graphical model for the above described links appears like this:

Simple XLink to RDF Transformation

Following is how an extended link might be transformed into its RDF equivalent:

<sample2
  xmlns:xlink="http://www.w3.org/1999/namespace/xlink/"
  xlink:type="extended">

  <xlink:locator href="Source" role="role1"/>
  <xlink:locator href="Target" role="role2"/>
  <xlink:arc
    from="role1" to="role2"
    show="embed" actuate="onLoad"/>
  <xlink:title="The link title"/>
...

</sample2>

This simple link appears as follows in RDF syntax:

This link would be look like the following example, in RDF syntax:

<sample2>
  <rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:xlink="http://www.w3.org/1999/namespace/xlink/">
    <rdf:Description about="#xpointer(../..)">
      <xlink:type rdf:resource="xlink:extended"/>
      <xlink:locator rdf:about="Source" rdf:ID="role1"/>
      <xlink:locator rdf:about="Target" rdf:ID="role2"/>
    <xlink:arc>
      <xlink:from rdf:resource="#role1">
      <xlink:to rdf:resource="#role2">
      <xlink:show rdf:resource="xlink:embed"/>
      <xlink:actuate rdf:resource="xlink:onLoad"/>
          </xlink:arc>
      <xlink:title>The link title</xlink:title>
    </rdf:Description>
  </rdf:RDF>
</sample2>

This graphical model for the above described links appears like this:

Extended XLink to RDF Transformation

D. Working Group Members and Acknowledgements

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 (of Textuality), who served as co-editor on earlier 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.

E. Open Issues

dummy-issue
link-events
arc-semantics
require-xls-to-be-xml
step-control
not-an-xlink
resource-media-specification
role-ns
display-centric
embed-where
what-to-replace
behavior-ns