Web Magazine for Information Professionals

What Are XLink and Xpointer?

Brian Kelly explains XLink and XPointer.

Background

The What Is …? article in the last edition of Ariadne gave an introduction to XML, the Extensible Markup Language [1]. XML has been developed to overcome HTML’s lack of extensibility - with XML you will be able to define your own element tags. We have already seen a variety of communities defining element tags for use within their community, such as MathML [2] and MusicML [3].

Besides lacking extensibility, HTML is also limited in its hyperlinking functionality. XLink and XPointer are currently being developed in order to address these limitations.

XLink

In HTML hyperlinking is normally achieved using the <A> (anchor) element. This provides a simple uni-directional link: normally clicking on a hypertext link will cause the current document to be replaced by a new document.

XLink [4] provides much richer hyperlinking functionality which the hypertext community have argued is needed in order to provide a richer web infrastructure.

XLink enables multiple destinations to be provided. For example consider the XML portion illustrated below.

<p>What is an <a xml:link=“extended”>
<locator href=“glossary.xml” role=“Glossary definition”>

<locator href=“http://www.w3.org/TR/" role=“XML Link specification”> <locator href=“tutorial.xml” role=“Tutorial”> <locator href=“quiz.xml” role=“Quiz”>XLink?</a></p>

This could be rendered by a conforming XML browser as shown in Figure 1.

Multiple Link Destinations

Figure 1: Multiple Link Destinations

XLink also enables a variety of link behaviours to be specified, including embedding the resource in the original document, replacing the original document and creating a new window. For example:

<a href=“xlink-def.xml xml:link=“simple” show=“embed”> What is XLink?</a>
will result in the contents of the XML file xlink-def.xml being displayed in the original document, immediately following the hypertext link.
<a href=“xlink-def.xml xml:link=“simple” show=“replace”> What is XLink?</a>
will result in the contents of the XML file xlink-def.xml replacing the current document. This example is equivalent to conventional HTML hyperlink.
<a href=“xlink-def.xml xml:link=“simple” show=“new”> What is XLink?</a>
will create a new window containing the definition.

Three <show> attributes can be defined. In addition the <actuate> attribute can be used to define when the link traversal should occur. <actuate> can have two values:

actuate=“auto”
link traversal occurs when the resource is loaded) and
actuate=“user”
link traversal occurs on user action, such as clicking a link.

The <show> and <actuate> attributes can be used in combination. For example using show=“embed” actuate=“auto” in combination with a link to an image will result in the image being embedded in the document when the document is loaded. This is equivalent to the HTML <IMG> element.

XPointer

XLink provides a much richer hyperlink mechanism than is currently provided in HTML. HTML is also deficient in allowing the destination of the link to be processed. All that can be done using the <A> element besides pointing to the top of the document is pointing to a pre-defined internal anchor. This link, for example points to references in this article. In enabling this link to be defined, an internal anchor name had to be explicitly defined. It is not possible, for example, to point to the references for the What Is.. column in the last edition, as no internal anchor was defined. In addition it is not possible to process portions of a document.

XPointer [5] addresses these deficiencies. With XPointer it is possible to link to arbitrary locations in an XML document, even if the author has not provided internal anchor. In addition it is possible to point to portions of an XML document. For example you could point to a relevant paragraph in an XML document. A conforming XML browser could highlight the linked portion of the document.

XPointer makes use the tree structure in XML documents. For example if you wish to link to the second item in a list which has the unique ID of “interesting-facts” you could use the following XML link:

<a href=“http://www.foo.com/bar.xml#id(interesting-facts).child(3,item)">

Figure 2 illustrates the (simplified) tree structure for an XML document.

XML Tree Structure
Figure 2 XML Tree Structure

Using the XPointer language portions of the tree can be identified, such as the third paragraph of the first section in the first chapter.

Status Of XLink and XPointer

What is the status of the XLink and XPointer proposals? These two proposals are currently available as working drafts. The proposals are being developed by working groups within W3C. However the proposals are still at an early stage. Although the XLink draft is relatively stable we may see substantial changes before the proposals, in particular the XPointer proposal, are submitted as W3C Proposed Recommendations.

As well as the technical work which the working groups are addressing there are a number of legal issues which may have to be addressed. We have already seen a number of legal cases associated with hyperlinking on the web [6]. With a richer hyperlinking infrastructure we may well see even more disputes. If I provide a pointer to MacDonald’s website and I use XPointers to point only to the content and my XML browser only displays this content, and I am breach of copyright?

Further Information

Further information on XLink and XPointer is available at the following locations:

“XLL - XML Linking Language” at
<URL: http://www.sil.org/sgml/xll.html>
“XLink: The Extensible Linking Language” by James Tauber at
<URL: http://www.xmlinfo.com/xlink/>
The XML home page at
<URL: http://www.xml.com/>

References

1. What Is XML?, Ariadne Issue 15
<URL: http://www.ariadne.ac.uk/issue15/what-is/>
2. MathML, W3C
See <URL: http://www.w3.org/TR/REC-MathML>
3. MusicML, The Connection Factory
<URL: http://www.tcf.nl/trends/trends6-en.html>
4. XML Linking Language (XLink), W3C
<URL: http://www.w3.org/TR/WD-xlink>
5. XML Pointer Language (XPointer), W3C
<URL: http://www.w3.org/TR/WD-xptr>
6. Intellectual Property Rights Overview, W3C
<URL: http://www.w3.org/IPR/>

Author details

Brian Kelly
UK Web Focus
UKOLN
University of Bath
E-mail: b.kelly@ukoln.ac.uk