If XML is to get anywhere near as popular as HTML is today, it needs to address a pretty basic requirement: the ability to connect different pieces of data together. Luckily, the W3C has a solution...and it's called XLink. Read on for the scoop.
Now that you've seen the various XLink types in action, let's focus on the attributes available in the XLink namespace to provide more information on a particular link type or modify its behaviour.
Every element defining an XLink *must* contain a "type" attribute, which specifies what type of link it is - the value for this attribute may be any one of "simple", "extended", "locator", "arc", "resource", "title" or "none".
In addition to the "type" attribute, the XLink specification defines nine additional attributes:
The "href" attribute is used to specify the URL of a remote resource, and is mandatory for locator links. In addition to the URL of the remote resource, it may also contain an additional "fragment identifier", which drills down to a specific location within the target document.
The "show" attribute is used to define the manner in which the endpoint of a link is presented to the user. The value of this attribute may be any one of "new" (display linked resource in a new window); "replace" (display linked resource in the current window, removing whatever's currently there); "embed" (display linked resource in a specific area of the current window); "other" (display as per other, application-dependent directives); or "none" (display method unspecified)
The "actuate" attribute is used to specify when a link is traversed - it may take any of the values "onLoad" (display linked resource as soon as loading is complete); "onRequest" (display linked resource only when expressly directed to by the user, either via a click or other input); "other" and "none".
The "label" attribute is used to identify a link for subsequent use in an arc.
The "from" and "to" attributes are used to specify the starting and ending points for an arc respectively. Both these attributes use labels to identify the links involved.
The "role" and "arcrole" attributes reference a URL which contains information on the link's role or purpose. Most often, you can ignore these attribute, as they are intended primarily for descriptive purposes. The only exception to this is when the "arcrole" attribute used in conjunction with a linkbase - more on this later.
The "title" attribute, not to be confused with the title type of link, provides a human-readable descriptive title for a link.
It should be noted that it is not necessary for all these attributes to be present in a particular XLink definition. It is certainly mandatory for any element defining an XLink to contain a "type" attribute, but with this obvious exception, different types of links have different attribute requirements.
Here are the basic rules:
1. A simple link may contain an "href" attributes to define the remote resource, and optional "show" and "actuate" attributes to define link behaviour; however, none of these are mandatory.
2. An extended link may contain optional "role" and "title" attributes to define its purpose.
3. A locator link must contain an "href" attribute to define the URL of the remote resource. It typically also uses an optional "label" attribute to identify itself for arc traversals.
4. A resource link usually contains an optional "label", again for purposes of arc traversals.
5. An arc typically contains optional "from" and "to" attributes to define the direction of link traversal, optional "show" and "actuate" attributes to specify how and when to traverse links, and an optional "arcrole" attribute if used in the context of a linkbase.