Stylus Studio XML Editor

Table of contents

Appendices

4 XLink Markup Design

XLink Markup Design

This section describes the design of XLink's markup vocabulary.

Link markup needs to be recognized reliably by XLink applications in order to be traversed and handled properly. XLink uses the mechanism described in the Namespaces in XML Recommendation [xname] to accomplish recognition of the constructs in the XLink vocabulary.

The XLink namespace defined by this specification has the following URI:

http://www.w3.org/1999/xlink

As dictated by [xname], the use of XLink elements and attributes requires declaration of the XLink namespace. For example, the following declaration would make the prefix xlink available within the myElement element to represent the XLink namespace:

<myElement
  xmlns:xlink="http://www.w3.org/1999/xlink">
  ...
</myElement>
NOTE: 

Most code examples in this specification do not show an XLink namespace declaration. The xlink prefix is used throughout to stand for the declaration of the XLink namespace on elements in whose scope the so-marked attribute appears (on the same element that bears the attribute or on some ancestor element), whether or not an XLink namespace declaration is present in the example.

XLink's namespace provides global attributes for use on elements that are in any arbitrary namespace. The global attributes are type, href, role, arcrole, title, show, actuate, label, from, and to. Document creators use the XLink global attributes to make the elements in their own namespace, or even in a namespace they do not control, recognizable as XLink elements. The type attribute indicates the XLink element type (simple, extended, locator, arc, resource, or title); the element type dictates the XLink-imposed constraints that such an element Must, May, etc. follow and the behavior of XLink applications on encountering the element.

Following is an example of a crossReference element from a non-XLink namespace that has XLink global attributes:

<my:crossReference
  xmlns:my="http://example.com/"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xlink:type="simple"
  xlink:href="students.xml"
  xlink:role="http://www.example.com/linkprops/studentlist"
  xlink:title="Student List"
  xlink:show="new"
  xlink:actuate="onRequest">
Current List of Students
</my:crossReference>

Using global attributes always requires the use of namespace prefixes on the individual attributes and the use of the type attribute on the element.