What is XLink?
As XML replaces HTML in some cases, there was of course the necessity of implementing the ability to link text passages and documents by using links. In XML this is possible by using the sublanguage XLink. It is a matter of course, that XML not only supports the simple links HTML knows; again, it is shown that XML is not only a further development of HTML or any other language, but a complete new point of view.
As the next step, simple and extended links, the two kind of links, XLink knows, are introduced. But before this can be done, it is necessary to show the different types of elements and attributes the XLink namespace allows.
| Parent type | Significant child types |
|---|---|
simple |
none |
extended |
locator, arc, resource,
title |
locator |
title |
arc |
title |
resource |
none |
title |
none |
(source: W3C)
The upper table shows that the simple type of link normally does not contain any other element. In contrast to the simple one, the extended type of link may contain locator, arc, resource and title typed subelements, whereas the locator and the arc typed ones contain title-typed elements themselves. The functions of these different typed elements are explained in the following table:
| locator-type elements | They address the remote resources which are participating in the link. |
| arc-type elements | These define traversal rules between the different resources of the link. |
| title-type elements | They are a kind of label for a link The advantage is that they are in a human-readable form. |
| resource-type elements | The counterparts to the locator-type elements - these ones address the local resources which are part of the link. |
The next table displays all possible typifications of elements on the x-axis and all possible attributes on the y-axis. If the corresponding cell contains no entry, the element does not contain the attribute. If there is an "O" in the cell, the attribute is optional, if there is an "R", it is required by the element. The meaning of the different attributes is also explained below.
simple |
extended |
locator |
arc |
resource |
title |
|
|---|---|---|---|---|---|---|
type |
R | R | R | R | R | R |
href |
O | R | ||||
role |
O | O | O | O | ||
arcrole |
O | O | ||||
title |
O | O | O | O | O | |
show |
O | O | ||||
actuate |
O | O | ||||
label |
O | O | ||||
from |
O | |||||
to |
O |
(source: W3C)
Simple Links
These links simply connect a local resource with a remote resource, wherefore a simple link is in every case an outbound link (shown in the following picture).

This kind of link is not able to:
- supply arbitrary numbers of local and remote resources
- specify an arc from its remote resource to its local resource
- associate a title with the single hardwired arc
- associate a role or title with the local resource
- associate a role or title with the link as a whole
Because of this very special functionality, the simple link can only be used in few cases. But also the simple link contains most of the listed attributes which are explained now:
| type |
This attribute shows the typification of its link. It is mandatory for all XLink elements. |
| href | href contains the URI reference which points at the specified remote resource |
| role | The item contains an URI reference which identifies some resource that describes the meaning of the resource. |
| arcrole | The item contains an URI reference which identifies some resource that describes the meaning of the resource (in this special case it describes an arc element). |
| title | title is a human readable (it is a string) description of the resource (e.g. used in the link menu). |
| show | A behavior attribute which defines how to handle the presentation of a linked resource. Possible values are new (opens a new window), replace (replaces the information in the actual window), embed (sets the information in place of the actual window), other (the presentation is not defined here) and none (the presentation is not defined at all). |
| actuate | A behavior attribute which defines how to handle the desired timing of traversal from the starting resource to the ending resource. Possible values are onLoad (the link is traversed when the starting resource is loading), onRequest (the link is only traversed, if a special request after loading is sent), other (the behavior of the traversation is not defined here) and none (the behavior of the traversation is not defined at all). |
The following DTD shows a possible implementation of a simple link (source: W3C):
|
<!ELEMENT
studentlink ANY> |
And its usage in an XML document (source: W3C):
|
<studentlink xlink:href="students/patjones62.xml">Pat Jones</studentlink> |
Extended Links
In contrast to simple links the extended ones allow multiple references in arbitrary numbers and both kinds of resources (local and remote ones); they may contain rules for traversing (therefore twodirectional links are possible) and roles or titles for their contained references. One very important feature of an extended link is its capability to exist in a separate document, which allows the centralization and thus an easier maintenance of links. The following graphs show most of the functionality:

As can be seen in the left graph, referencing a local resource is one of the additional functions, the extended link supports. This is realized by using a resource type subelement which must contain the attribute type and may contain the attributes role, title, and label. The first three have already been explained and label is like an ID for defining traversal rules, which use the resource. That means that the resource is referenced by its label attribute in the from- or to-attribute of an arc (as it e.g. done in the right example between the two resources), which defines in contradiction to a normal link a bidirektional association between the two referenced resources.
The linking of remote resources is implemented by using locator type subelements which can contain title elements themselves. These elements extend the funtionality of the title attribute by offering the option to specifiy more than one human readable description. Compared to the resource type element, this one needs an href attribute for referencing the remote resource.
The last kind of link is the arc type subelement, defining traversal rules between linked resources (see right graph) respectively the origin of the link and the target (see left graph). This element is able to carry title elements itself, too, and contains in every case the attribute type and optionally the attributes arcrole, title, show, actuate, from and to. The last two attributes are used for defining the two resources the arc links, which are referenced by their label attributes. An explanation of the other attributes can be found above, in the description of the simple link.
The following DTD shows a possible implementation of an extended link (source: W3C):
|
<!ELEMENT
courseload ((tooltip|person|course|gpa|go)*)> |
And its usage in an XML document (source: W3C):
<courseload>
<tooltip>Course Load for Pat Jones</tooltip>
<person
xlink:href="students/patjones62.xml"
xlink:label="student62"
xlink:role="http://www.example.com/linkprops/student"
xlink:title="Pat Jones" />
<person
xlink:href="profs/jaysmith7.xml"
xlink:label="prof7"
xlink:role="http://www.example.com/linkprops/professor"
xlink:title="Dr. Jay Smith" />
<!-- more remote resources for professors, teaching assistants, etc. -->
<course
xlink:href="courses/cs101.xml"
xlink:label="CS-101"
xlink:title="Computer Science 101" />
<!-- more remote resources for courses, seminars, etc. -->
<gpa xlink:label="PatJonesGPA">3.5</gpa>
<go
xlink:from="student62"
xlink:to="PatJonesGPA"
xlink:show="new"
xlink:actuate="onRequest"
xlink:title="Pat Jones's GPA" />
<go
xlink:from="CS-101"
xlink:arcrole="http://www.example.com/linkprops/auditor"
xlink:to="student62"
xlink:show="replace"
xlink:actuate="onRequest"
xlink:title="Pat Jones, auditing the course" />
<go
xlink:from="student62"
xlink:arcrole="http://www.example.com/linkprops/advisor"
xlink:to="prof7"
xlink:show="replace"
xlink:actuate="onRequest"
xlink:title="Dr. Jay Smith, advisor" />
</courseload>
|
For more detailed information about XLink, please follow the links below.
| the XLink definition |