XLink (syntax)
XLink is an attribute-based syntax for defining links in XML documents. An XLink can be a connection from a point A to a point B (similar to the hyperlink element known from HTML<a>
). However, you can also join documents in two directions (i.e. from A to B and back again). Furthermore, XLink can also represent connections that are multidirectional (different paths between any number of XML documents). The documents to which an XLink points do not have to be XML documents.
XLink is a recommendation from the World Wide Web Consortium . Despite hesitant implementation, the W3C continues to regard XLink as the future standard for hyperlinks in the WWW and expressly gives it preference over other methods such as HLink in particular .
XLinks are built into XML elements with any element name by adding certain XML attributes of the XML namespace http://www.w3.org/1999/xlink to the elements (usually xlink
linked to the prefix ).
Simple XLinks
Simple XLinks can be in any element and are described by the following attributes:
- They are
xlink:type="simple"
explained by the attribute assignment. - The actual reference contains the attribute , whereby reference has to be replaced by a Uniform Resource Identifier , which by definition may also contain an XPointer expression for internal document references.
xlink:href="Verweis"
Optional are the attributes:
-
xlink:title
containing a user-friendly title of the link. All types of XLink-attributed elements may have anxlink:title
-attribute, including the extended types mentioned below. -
xlink:show
that defines how the link should be displayed and that the valuesnew, replace, embed, other, none
can assume. -
xlink:actuate
that determines when the reference should be followed and that the valuesonLoad, onRequest, other, none
can assume. -
xlink:role
that describes the meaning of the links to each other. It contains a URI that comments or explains the remote resource. -
xlink:arcrole
, has the same semantics asxlink:role
, but describes arc elements that cannotxlink:role
accept an attribute. It contains an absolute URI that refers to a description of the resource. This resource marks the relationship that the arc describes.
Extended XLinks
Extended XLinks provide options for bidirectional and multidirectional referrals as well as referencing referrals. In contrast to the simple XLinks, several elements are required for this:
- an element with the attribute
xlink:type="extended"
forms the framework of the extended XLink. Except for one,xlink:title
the above Bear attributexlink:role
.
The functionality of the complex XLink declared in this way is defined in sub-elements, which can again be named as desired and which become XLink components with the following attributes:
xlink:type="locator"
Elements attributed with must contain an additional attribute , whereby URI is to be replaced by a Uniform Resource Identifier . It makes sense to also specify an attribute and thus a name that represents the declared URI.xlink:href="URI"
xlink:label
-
xlink:type="resource"
inserts resources that can be referenced within the document.xlink:label
An attribute must be specified so that these resources can be addressed by other links at all .
Up to this point there are no actual references, but document-internal and external URIs, which are each represented by a label. These are now related to xlink:type="extended"
each other with (one) further sub-element (s) of the element :
- An
xlink:type="arc"
element with attributed meaningfully contains the following attributes:xlink:from="..."
andxlink:to="..."
, whereby the previously defined labels are used. The attributes already explained are optionalxlink:title, xlink:show, xlink:actuate, xlink:arcrole
Examples
<element1 xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="http://www.w3.org/">W3C</element1>
<element2 xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:href="user.xml"
xlink:type="simple"
xlink:role="http://www.example.com/list/userlist.xml"
xlink:title="User List">Current List of Users</element2>
<mehrfachlink xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="extended">
<start xlink:type="resource"
xlink:label="start"
xlink:title="Hier klicken"/>
<ziel xlink:type="locator"
xlink:href="http://en.wikipedia.org"
xlink:label="wikipedia"/>
<ziel xlink:type="locator"
xlink:href="http://de.wikipedia.org"
xlink:label="wikipedia"/>
<pfad xlink:type="arc"
xlink:from="start"
xlink:to="wikipedia"/>
</mehrfachlink>
Software support
The following is an overview of how various applications support the W3C XLink recommendation.
Firefox
Mozilla Firefox has limited support for simple XLinks. (As of September 20, 2009)
- Links with an
xlink:show="embed"
attribute do not work.
More browsers
Other browsers such as Internet Explorer , Opera and Google Chrome are currently not supported. (As of September 20, 2009)
See also
Web links
- XLink specification version 1.1
- XLink specification version 1.0 (German)
- XPath specification version 1.0
- XPointer xpointer () Scheme (W3C Working Draft 19 December 2002)
- XPointer Framework
- XPointer element () Scheme
- XPointer-xmlns () scheme
- XML XPointer Requirements
Tutorials
- HTMLWorld: XLink
- data2type: Introduction to XLink
- Jeckle: XML Linking Language (XLink)
- FH Wedel: XLink, XPath, XPointer
Notes and individual references
- ↑ a b XLink tests. Retrieved September 20, 2009 .