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

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

Here,
CharClasses
must match the
id
attribute of an element such as

,

, or

. Originally, quite a range of different elements could act as the target of a

, for example, an

or a

, but the code has been revised so that only

and

elements are still supported. The form of the link depends on the type of target, so the template rule contains an

instruction that handles all the possibilities. It reads as follows:


  

  

    

      

        specref to non-existent ID: 

        

      

    

    

                    or starts-with(local-name($target), ‘div’)”>

      

    

    

        (error case: see below) 

    

  


This is another place where the code is substantially improved from earlier versions of the stylesheet. In previous versions, the

contained a long list of choices, with different formatting code for each kind of target element. This has now been properly moved into one template rule for each kind of element, using
mode=“specref”
. However, there's still a strange omission. In principle, an overlay stylesheet ought to be able to add a new rule for references to another kind of element; for example, a reference to a function prototype in the XSLT specification. But the rewrite hasn't been done in a way that allows this—before calling

, it checks that the template is on the approved list. It would have been much better to put the error case in a fallback template rule defined with

. (In fact, I wonder why there is no provision for a

containing a reference to an

, that is, to a non-normative appendix. The stylesheet actually contains template rules for

, and indeed for many other possible targets such as

,

,
, and

. This looks like unreachable code to me.)

Here are the template rules that can be invoked:

The
href
attribute is generated using the named template
href.target
, as before. For a reference to an

, the text of the hyperlink contains the issue number and the title (the

element) of the issue. For references to

,

, and so on, the text of the link contains the section number and section heading of the target section.

Other books

Little Boy Blue by Kim Kavin
Second Time Around by Nancy Moser
Oracle by Jackie French
Flying High by Annie Dalton
Relentless (The Hero Agenda, #2) by Tera Lynn Childs, Tracy Deebs
The Earl I Adore by Erin Knightley
Dissolve by Hunter, L.V.
Secret Star by Nancy Springer
Eye Candy by R.L. Stine