[bktshort=Genesis] or v[position()>4 and position()<12]. Because
this is an XML document, angle brackets are encoded as > and <.
Note on XPointers
XPointer expressions are mostly XPath expressions, with two additions:
Expressions that refer to a specific point between two characters in the text
content of the document, and
Expressions that refer to character ranges within the text content of the
document.
All of the XPointers in this chapter are also XPaths.
It is anticipated that XPointers will typically be used in XLink elements to
indicate link endpoints. When used that way, the XPointer expression is given as
an argument to the xpointer() function, as in our example.
An XLink Application
Our first XLink application does not do much; it does not even output any blue
underlined links to click on. However, it does process an extended link in a gen-
eral way, extracting all the information it contains, including XML data
referenced by XPointers. It is a Web application that uses Java Server Pages (JSPs)
and XSLTs and runs in Tomcat. The XSLTs it uses introduce some useful general-
purpose techniques.
The application assumes that there is a source of XML data that is not subject
to change (the King James Bible). A separate linkbase file contains extended
links that are cross-references within the source. The entry page to the appli-
cation is the familiar xx.jsp that expects, as you recall, two arguments: an XML file
and an XSLT to apply to it. In this application, the XML file is our linkbase and the
XSLT is a data-specific program, dreams.xsl. It incorporates, by inclusion, a data
independent, general purpose XLink application called linkTransform.xsl. This is
a fairly complex program that is partially discussed in the next section; a com-
plete explanation will have to wait until Chapter 5. We use it in this chapter to
provide an interesting example of XLink processing. You can experiment with
dreams.xsl and the linkbase even if you skip the next section altogether.
Schematically, the application consist of components shown in Figure 2-6.
The components above the broken line are completely explained in this chapter
and can be experimented with. The components underneath the broken line are
briefly explained in the next section and completely explained in Chapter 5.
67
Well-Formed Documents and Namespaces