What is XLink?
An XML application for creating both simple and sophisticated hyperlinks in XML
A W3C recommendation.
Takes HTML's <A> links to the next level.
Enables association of metadata with a link.
Enables creation of links that reside in a location separate from the linked resources ( extended links ).
Enables creation of both unidirectional and bi-directional links.
Enables creation of links among more than two resources.
- Enables online delivery of richly hyperlinked XML documents.
- Eliminates or reduces need to translate from XML to HTML.
- Enables use of different “webs” of links for the same information set to provide different views or access paths for different tasks or user sets.
- Eliminates need to reinvent linking structures for XML document types.
- Applications can use generic XLink processors to support link processing.
How It Works:
XLink takes the familiar linking facility from HTML and adds a number of important refinements. In HTML, an <A> link is really only useful for enabling navigation from one point to another—it cannot express anything about the reason, or semantic , of the link .1 In addition, HTML links are limited to linking from one place in an HTML page to one other resource. Many XML applications require more linking features than a simple A-style link can provide. XLink addresses these requirements by providing a full range of linking constructs, from simple A-style links to arbitrarily complex webs of links.
The XLink recommendation does not define an XML document type. Rather it defines abstract element types and related sets of attributes that you can map your elements to. For example, if your document type requires a cross reference element, you can bind it to XLink by using the XLink “type” attribute to indicate that your “crossref” element is also a conforming XLink simple link:
<crossref xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="otherdoc.xml#//section"/>
The value “simple” for the XLink “type” attribute tells an XLink-aware processor that this element can be interpreted as a simple link. The XLink recommendation requires that the link pointer be on an attribute called “href” in the XLink name space.
This mapping mechanism allows generic XLink-aware processors to process documents in any document type for the purpose of resolving links and enabling link-based navigation or other processing.
While hyperlinks are most often used for navigation, they can be used for other purposes. Among other things, XLink allows XML documents to:
- Assert relationships among more than two resources. These relationships can be strongly typed, for example, to reflect relationships in a particular business model.
- Link together resources in other documents.
- For example, XLink links can establish links among elements in read-only documents. This allows new links to be added to information sets without the need to change existing documents.
XLink also provides a simple link behavior model; higher-level applications layered on XLink can specify alternate or more sophisticated rendering and processing treatments.
XLink is similar to HyTime . They both provide essentially the same linking structures and semantics. The primary difference between XLink and HyTime , besides a few unimportant syntax differences, is that XLink does not provide any form of indirect addressing, while HyTime provides a rich set of indirect addressing mechanisms. This difference is a direct result of XLink's design for Web delivery—in Web delivery, indirect addressing would be, at best, very expensive to process, and in some cases impossible. This lack of indirection makes it difficult to use XLink for authoring because link management mechanisms depend on indirection. This suggests that HyTime is most appropriate for authoring systems, while XLink is most appropriate for Web-based delivery. Because HyTime and XLink have essentially identical abstract linking models, it is relatively easy to translate from HyTime based links to XLink-based links.
1 Technically, the <A> element does provide a facility for naming the link type or role, the “rel” attribute. However, it is ambiguous as to whether the rel attribute describes the link as a whole, the role of the target resource, or the role of the <A> element itself (as one end of the link). XLink addresses this problem by enabling full specification of the semantic labels for all the components of a link.