Linking in XHTML 2.0
By Micah Dubinko2005-05-04
Linking: From Any Element
Listing 1 uses the a element -- which stands for an "anchor" -- to define an outgoing link. Most people, however, think about anchors as link targets, not sources. Only by historical accident has the a element come to be the de facto way to specify links. In other words, there?s no good reason why other elements shouldn't also be able to serve as link ends. XHTML 2.0 dispenses with this limitation and broadly allows href along with several other attributes.
A table cell, an image, a list item -- anything can be a link. Just add an href attribute and put the destination URL as the value. In fact, one of the several attribute collections defined by XHTML 2.0 is the Hypertext attribute collection, which applies to every element in XHTML 2.0.
Why not XLink?
The W3C has a Recommendation called XML Linking Language (XLink -- see Resources) intended to be used for hypertext linking. However, XHTML in any version has been deemed incompatible with XLink. Still, XHTML has adopted the useful terminology and semantics defined in that specification.
XLink helps specify when a link activation occurs, including onLoad for typical images on a Web page, and onRequest for manually-activated hyperlinks. XLink also helps specify link behavior, including replace for hyperlinks that replace the current page, new for pop-up windows, and embed for things like images. XLink contains additional wording to ensure that these concepts can apply to contexts beyond basic visual browsers, including voice and accessibility applications.
So, what is incompatible about XLink? Much has been written about this (for a sampling, see Resources), but in short XLink expects all links to be named xlink:href, with the prefix mapped to a namespace in the usual fashion. As you will see in this article, XHTML 2.0 requires different kinds of links with different names, often on the same element.
Tutorial Pages:
» How XHTML 2.0 is Changing the Way People Think About Web Linking
» Linking: From Any Element
» The Hypertext Attribute Collection
» The Embedding Attribute Collection
» Are We There Yet?
» Resources
First published by IBM DeveloperWorks
