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

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

Making Cross-References

If you read W3C working drafts and recommendations online, you'll notice that they are very heavily hyperlinked. Terms with special meanings are linked to their definitions; cross-references from one section of the specification to another are represented by hyperlinks; references to other documents are represented first by a link to the bibliography and then from the bibliography to the external document on the Web if it is available; there are references from a document to previous versions of the document, and so on. In the XML specification, every use of a grammar symbol such as
elementdecl
is linked to the grammar rule where it is defined. Similarly, in the XSLT specification, every use of an XSLT element name such as
xsl:sequence
is linked to its definition. In this section, we will look at the rules that are used to create these links. There are many of these, and I'll pick a selection that illustrates the techniques used.

Let's take the linking of term references to term definitions. Here is an example of a term definition from the XML specification that defines one term and contains two references to terms defined elsewhere in the specification:

A data object is an

XML document if it is well-

formed, as defined in this specification. A well-formed XML document

may in addition be valid if it meets certain

further constraints.


(A curious definition, because having said that all XML documents are well-formed, it seems rather odd to use the phrase
well-formed XML document
in the very next sentence, as if there were any other kind. But we are not here to criticize the prose.)

The

element identifies this as a term definition. The
id
attribute identifies this term definition uniquely within the document. The
term
attribute is the term being defined. This is also tagged using the

element where it appears in the text. This might appear redundant, but the DTD requires it. There are some cases where the two differ; for example, the XML specification states:

There is exactly one

element, called the root, or document element, no part of which

appears in the content of

any other element.

I'm afraid I've never been sure as to whether the term being defined here is
root
or
root element
.

The

element has a
def
attribute that must match the
id
attribute of some

. You find that confusing? Well so do I.

Other books

I, Emma Freke by Elizabeth Atkinson
Running Out of Time by Margaret Peterson Haddix
No Regrets by Claire Kent
Savage Betrayal by Scott, Theresa
The Tudor Secret by C. W. Gortner
Unbroken Hearts by Anna Murray