Whole document tree
    

Whole document tree

OLink Semantics in the DocBook DSSSL Stylesheets

OLinking in HTML

Constructing cross-document links with entities in the authoring system is all well and good, but how does it work on the web? The heart of the matter is mapping from the SGML/XML entity in the TargetDocEnt to the base URL on the web, and there are two options: early binding and late binding.

Simple OLinks

Simple OLinks avoid some of the gory machinery required to handle general OLinks at the expense of most semantic variation.

The simple semantics come into play when an OLink has the following form:

<olink targetdocent="entity"></olink>

In particular, note that there is no LinkMode. The generated text in this case is derived entirely from the public and system identifiers by the (olink-resource-title) function. By default, this is simply the title of the document derived from the description field in the public identifier. The first and last “words” of the public identifier description field are trimmed off, leaving what is presumably just the document title. For example, given “-//Norman Walsh//DOCUMENT My Document Title V1.0//EN”, the derived title would be “My Document Title”.

General OLinks

The generated text for general OLinks comes from the XRefLabel attribute on the relevant ModeSpec. The hard part is locating the appropriate replacement text: the name, label, and title of the element pointed to by the combination of the TargetDocEnt and LocalInfo.

One way to do this would be to load the TargetDocEnt, find the element with the ID mentioned in LocalInfo and extract the data directly. I chose something else because I see two significant problems with this approach:

  1. Loading and parsing potentially large documents potentially many times appears to have the potential for significant performance problems.

  2. It would not be possible to form OLink references to documents written in DTDs other than DocBook.

Instead of loading the actual target document, the stylesheets load a summary of that document's content. For DocBook documents, this summary can be generated by another DSSSL stylesheet, olink.dsl, supplied with the DocBook Stylesheet distribution. The first few lines of the summary for this document is shown in looks like this:.

The basic organization of the summary document is a nested series of divs and objs with titles (ttls). Attributes on these elements provide the IDs, labels, and names of the elements. The GI of the element is also provided. (If you find objects that you think are missing from the summary, please let me know).

The stylesheets locate this document by resolving the system identifier of the target document and replacing the SGML or XML extension with %olink-outline-ext% (.olink, by default).

Examples

The examples that follow are all links into the document shown in .

The ModeSpecs in this document are shown in .