Copyright ©2000 W3C® (MIT, INRIA, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply.
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.
The XML Linking Working Group invites comment on this 2000 January 19 XLink working draft, which it believes to be near completion.
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 [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.
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:
A
links normally replaces the current
view, perhaps with a user option to open a new window.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.
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.
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.
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.
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:
Many other linking systems, such as Dexter, FRESS, MicroCosm, and InterMedia, have also informed the design of XLink.
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.
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.
For the purposes of this specification, an XLink application is any software module that interprets XML documents containing XLink links or documents that participate in a link.
A specification of link traversal rules, including information about the direction and also possibly the context of traversal.
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:
resource
-type elementlocator
-type element
simple
-type element
An explicit relationship between two or more resources or portions of resources with an eye to presentation and traversal in user interfaces.
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.
A relationship between resources or portions of resources, encoded as an XLink linking element.
An XML element in the XLink namespace that asserts the existence and describes the characteristics of a link.
Document content that, by virtue of its presence inside a linking element, becomes a participating resource of that linking element.
Link data that identifies a remote resource that is participating in the 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.
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.
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.
Any participating resource of a link that is pointed to explicitly with a locator.
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].
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:
resource
-type elementlocator
-type element
simple
-type elementA 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.
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.
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 for the URI-reference to be valid. URI stands for Uniform Resource Identifier.
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> |
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.
Note:
This version of the specification has removed the element method of link recognition (where there are elements specified in the XLink namespace, not just attributes) because it was deemed just a convenience feature that lengthened the spec but offered no substantial benefit.
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 use 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) that dictates the
constraints such an element must follow.
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/namespace/" 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.
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 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 | X | |
title
|
X | X | X | X | X | |
show
|
X | X | X | |||
actuate
|
X | X | X | |||
from
|
X | |||||
to
|
X |
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" ... /> |
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> |
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/namespace/" xmlns:my="http://me.com/" xlink:type="simple" xlink:href="students.xml" my:lastEdited="2000-06-10"> Current List of Students </my:crossReference> |
XLink offers two kinds of 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 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 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, syntactically they are somewhat 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.
[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 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.
Notice that the lines that associate the resources do not have directionality. Without traversal rules being provided, the five 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.
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 linkarc
-type elements that provide traversal rules among
the link's participating resourcestitle
-type elements that provide human-readable labels
for the linkresource
-type elements that supply local resources that
participate in the linkIf 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.
A sample set of declarations for an extended
-type element
might look as follows:
<!-- courseload = extended-type tooltip = title-type go = arc-type student, course, audit, advisor = locator-type gpa = resource-type --> <!-- 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"> <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" /> <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> |
If an extended link contains one or more local resources, then by definition the link is inline.
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.
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 a resource
-type element might
look as follows:
<!-- 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> |
An extended link indicates the remote resources that participate in it by means of a series of one or more 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; 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 a locator
-type element might
look as follows:
<!-- 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" /> |
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. 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 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 a title
-type element might
look as follows:
<!-- 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 (when used within a locator
-type element):
<advisor xlink:href="profs/jaysmith.xml"> <advisorname xml:lang="en"> <name> <honorific>Dr.</honorific> <given>Jay</given> <family>Smith</family> </name> </advisorname> </advisor> |
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; 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
), 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 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:
The diagram shows directional traversal arcs reflecting the following settings, where both As and Cs are allowed to initiatve 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, 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:
<!-- 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
identical from
and to
values.
A sample set of declarations for an arc
-type element might
look as follows:
<!-- 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 > |
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" /> |
In order for an XLink application to initiate traversal from a starting
resource that is remote (that is, specified by a locator
-type
element), the application 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. If the extended link is stored in the same XML document as the
one containing the starting resource, the application has an easy way to find
relevant links. Howeiver, if the extended link is stored separately from the
starting resource, the application must be directed to find the link information
somehow.
For example, if you have an out-of-line extended link that associates words in text (one remote resource) with their definitions (another remote resource), in order for the document containing the words in text to offer traversal to the definitions (for example, by allowing users to click on them to bring up the definition), 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 a remote resource (the document containing the words in text, in our example) 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 for any resource. 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 and other XML documents whose extended link locators point into it, so that starting resources within the current document may be found.
[Definition: ] A description of linkbases
relevant to a particular resource is called an external linkset.
XLink in-band 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/namespace/" xlink:role="xlink:external-linkset"> <xlink:loc ... /> </extendedlink> |
Constraint: External Linksets Must Be XML
Any resource identified as 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.
A sample set of declarations for an external linkset might look as follows:
<!-- 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> |
[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.
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, 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 #REQUIRED 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; 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, 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 the attributes 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 applications 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 a simple
-type element might
look as follows:
<!-- studentlink = simple-type --> <!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 (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. ... |
The attribute that identifies XLink element types is type
.
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", "title",
or "none".
When the value of the type
attribute is none
,
the element is not an XLink element; any XLink-related attributes or content
has no XLink-specified relationship to the element.
A sample attribute-list declaration for type
on an element
intended to be simple
-type might look as follows:
<!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 value is inferred to be simple
in some circumstances and none
in others:
<!ATTLIST commandname xlink:type (simple|none) #IMPLIED xlink:href CDATA #IMPLIED > |
Whenever it is desired to make commandname
a simple link,
the application could use the presence of a value on the href
attribute to infer that the value of type
is simple
.
In all other circumstances, the value could be inferred to be none
.
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 arbitraryElement xlink:type (simple |extended |locator |arc |resource |title |none) #IMPLIED ... > |
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].
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].
A sample attribute-list declaration for href
on an element
intended to be simple
-type might look as follows:
<!ATTLIST simplelink xlink:href CDATA #REQUIRED ... > |
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
, 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 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 element intended to be simple
-type might look as follows:
<!ATTLIST simplelink ... xlink:role NMTOKEN #IMPLIED xlink:title CDATA #IMPLIED ... > |
show
and actuate
) The behavior attributes are show
and actuate
.
They can be used on the simple
- and arc
-type elements.
When they are 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
or implied by the link's arcs.
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.
A sample attribute-list declaration for show
and actuate
on a simple
-type element might look as follows:
<!-- simplelink = simple-type --> <!ATTLIST simplelink ... xlink:show (new |replace |embed |undefined) #IMPLIED xlink:actuate (onLoad |onRequest |undefined) #IMPLIED ... > |
show
AttributeThe 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" (and their prefixed equivalents; see the constraint
note below). 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, 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]. The
namespace associated with a show prefix must be declared on some element in
whose scope the show
attribute appears. Any prefix used that
corresponds to the XLink namespace must not be used with any "local
part" of the value that is not XLink-related; for example, assuming
that xlink
is associated with the XLink namespace, xlink:new
is acceptable but xlink:mybehavior
is not.
Conforming XLink applications should apply the following treatment for 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.
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.
actuate
AttributeThe 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" (and their prefixed equivalents; see the constraint
note below). 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, 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].
The namespace associated with an actuate prefix must be declared on some element
in whose scope the actuate
attribute appears. Any prefix used
that corresponds to the XLink namespace must not be used with any "local
part" of the value that is not XLink-related; for example, assuming
that xlink
is associated with the XLink namespace, xlink:onLoad
is acceptable but xlink:mybehavior
is not.
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 in the display. 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.
The following sections detail requirements for processing and conformance.
For XLinks to be processed by an XML processor, the processor must support XML 1.0 plus Namespaces.
An element conforms to XLink if:
type
attribute whose value is one
of "simple", "extended", "locator", "arc", "resource", "title",
or "none", andA conforming XLink application is one that:
Lack of conformance in any area shall generate an error.
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. |
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 (Internet Engineering Task Force).
RFC 1738: Uniform Resource Locators. 1991. (See http://www.w3.org/Addressing/rfc1738.txt
). |
IETF (Internet Engineering Task Force). RFC
1808: Relative Uniform Resource Locators. 1995. (See http://www.w3.org/Addressing/rfc1808.txt
). |
S. Bradner, editor. Key words
for use in RFCs to Indicate Requirement Levels. March 1997. (See http://www.ietf.org/rfc/rfc2119.txt
.) |
IETF (Internet Engineering Task Force). RFC
2396: Uniform Resource Identifiers. 1995. (See http://www.ics.uci.edu/pub/ietf/uri/rfc2396.txt
). |
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/
). |
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
.) |
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. |
Jonathan Marsh, editor. XML Base (XBase).
World Wide Web Consortium, 1999. (See http://www.w3.org/TR/xmlbase
.) |
John Cowan and David Megginson, editors. XML Information
Set. World Wide Web Consortium, 1999. (See http://www.w3.org/TR/xml-infoset
.) |
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
.) |
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
.) |
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/
.) |
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
.) |
Following are examples of how to map XLink to Resource Description Framework [RDF], with graphical demonstrations of the semantics involved.
Issue (rdf-examples):
We need to check that these examples are correct!
The first example shows how the following simple link can be transformed into its RDF equivalent.
<!-- sample = simple-type --> <sample xlink:href="target" xlink:role="role" xlink:title="The link title" xlink:show="embed" xlink:actuate="onLoad" /> |
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:
Following is how an extended link might be transformed into its RDF equivalent:
<!-- sample2 = simple-type loc = locator-type go = arc-type title = title-type --> <sample2> <loc xlink:href="Source" xlink:role="role1" /> <loc xlink:href="Target" xlink:role="role2" /> <go xlink:from="role1" xlink:to="role2" xlink:show="embed" xlink:actuate="onLoad" /> <xlink:title="The link title" /> ... </sample2> |
This simple link appears as follows 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:
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.