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
7.64Mb size Format: txt, pdf, ePub
ads

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 .


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

Other books

Unfiltered & Unlawful (The Unfiltered Series) by Galvin, Payge, Douglas, Ronnie
Insanity by Lauren Hammond
Masters of Rome by Fabbri, Robert
Watch How We Walk by Jennifer LoveGrove
Stan Musial by George Vecsey
Retirement Plan by Martha Miller
Barbara Metzger by Wedded Bliss