XLinks let you link to a particular document, but you often need to be more precise than that. XPointers let you point to specific locations inside a documentwithout having to modify that document by embedding special tags or markers. To point to a specific location in a document, the XPointer specification builds on the XPath specification. As you recall, we covered the XPath specification in Chapter 13; it let you identify specific nodes in a document with expressions such as /child::*[position()=126]/child::*[position() =first()] . XPointers are in the W3C candidate recommendation stage. As of this writing, the version is September 11, 2001. You can find the most current version of this specification at www.w3.org/TR/xptr. Here's what W3C says about XPointers:
Although XPointer is built on the XPath specification (which is covered in Chapter 13 and is at www.w3.org/TR/xpath), the XPointer specification extends XPath in ways we'll see in this chapter. How do you add an XPointer to a document's URI to specify a specific location in a document? You can append # (following the HTML usage for URLs that specify link targets) and then xpointer() , placing the XPath expression you want to use in the parentheses. Here's an example: <MOVIE_REVIEW xmlns:xlink = "http://www.w3.org/1999/xlink" xlink:type = "simple" xlink:show = "new" xlink:href="http://www.starpowdermovies.com/reviews.xml#xpointer(/child::*[position( )=126]/child::* [position()=first()])"> Mr. Blandings Builds His Dream House </MOVIE_REVIEW> That gives us an overview of XLinks and XPointers. I'm going to cover both of these specifications, as well as the XBase specification, starting now with XLinks. |