XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (710 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
13.81Mb size Format: txt, pdf, ePub

The template rule for the

marks the definition as such, and generates an HTML anchor, like this:



  [

  

    Definition

  

  

  

  ]


The
id
and
name
attributes of the HTML

element are both used (by various browsers) to identify the element, and the
title
attribute identifies its role; it is not used by a conventional browser, but may be used, for example, by audio browsers.

The corresponding rule for the

element generates a link to this anchor:

This calls the named template
href.target
to produce the content of the
href
attribute. We've already seen this named template on page 1021. Note the use of the
key()
function to enable quick access to the target of the link: scanning the whole document, by using an expression such as
//termdef[@id=current()/@def]
, would be hopelessly slow unless you're lucky enough to be using a processor that optimizes the construct.

The other rules that generate internal links are all very similar to this pair.

The links to a section are a little more complex because they require the section number to be computed. In the source XML document, the links look like this:

Full definitions of the specific characters in each class

are given in .


Other books

Cowpokes and Desperadoes by Gary Paulsen
Soulcatcher by Charles Johnson
Triangles by Ellen Hopkins
Troublemaker by Joseph Hansen
Queen For A Night by Blake, Jennifer
Better Off Dead by Sloan, Eva
Under My Skin by M. L. Rhodes