The Foundation: XML, XSL, X-Link (3/4) - exploring XML
Extensible linking language (X-Link, formerly XLL)
The ability to link documents to one another is the killer feature of the Web, and has also given it its name. Having links standardized is crucial in order to ensure that everybody sees the same Web even in the XML world. This is more difficult to ensure as there are no pre-defined tags in XML (you remembered that from my first column, right?). So the W3C sat down to define the way XML documents can be linked to each other once and for all, and in the process extended the capabilities of links beyond the unidirectional, in-place variant of the infamous HTML <A HREF="">.
From the X-Link specification: "A simple hyperlink case is an HTML A element, which has these characteristics:
- The hyperlink is expressed at one of its ends.
- The hyperlink identifies the one other end (although a server may have great freedom in finding or dynamically creating that destination.)
- Users can only initiate travel from that end to the other.
- The hyperlink's effect on windows, frames, go-back lists, stylesheets in use, and so on is determined by user agents, not by the hyperlink itself. For example, traversal of A links normally replaces the current view, perhaps with a user option to open a new window."
Simple XML links
Simple XML links feature the familiar href attribute pointing to the target document, but also include optional meta-data such as role and title, and user agent hints like show and actuate. A simple example looks like this:
<xlink:simple href="shoppingcart.xml" role="shopping cart" title="Your Shopping Cart" show="new" actuate="user"> Items in your shopping cart </xlink:simple>
This denotes a reference to a shopping cart document, that will open a new window (as opposed to replacing the current page) when the user clicks on the link (as opposed to automatic links). It is equivalent to the HTML version:
<A HREF="shoppingcart.xml" TARGET="_new">Items in your shopping cart</a>
Contrary to HTML any XML tag can be turned into a linking element, for instance a (newly invented) items tag:
<items xmlns:xlink="http://www.w3.org/XML/XLink/0.9" xlink:href="shoppingcart.xml"> Items in your shopping cart </items>
Extended XML links
Extended links are modeled after state-of-the-art hyperlinking systems, and offer the full range of multiple target locations, bi-directional linking, and out-of-place links. The difficulty lies once again, similar to XSL-FO, in implementing all of it. The central concepts of extended links are locators and arcs. A locator defines an endpoint of navigation, may it be source or target. An example would be:
<xlink:locator id="xmlHome" href="/xml" role="Homepage" title="Home of XML"/>An arc defines a a connection between a source and a target locator. More than one arc can make up an extended link, and none of the href's need to be within the document containing the link, so it is possible to have an arbitrarily complex relation between sources, targets, and their locations. Unfortunately this calls for an equally complex implementation, unless you cut corners and only implement a subset.
Created: Dec. 20, 1999
Revised: Dec. 21, 1999