Proposal for XREF element

Evan Kirshenbaum (
Mon, 31 Jul 95 21:43:11 EDT

Much as I hate to propose adding new elements, I don't see any way to
get this functionality in current (or proposed) HTML, so ...


Within OL elements, LI elements are typically rendered as an
automatically generated number, with the format (in the future) being
controlled by style sheets. In the 3.0 dtd, it is mentioned that H*
elments can also be numbered "although this is a matter for style
sheets". Presumably style sheets will want to assert that certain
classes of other elements (CAPTION, P(?)) should also be rendered

Unfortunately, the author of the document cannot be sure of the format
that such a number will show up when presented to a user. This
becomes problematic when the want to refer to a specific item as,

<li>Catch the fish,
<li>Clean the fish,
<li>Cook the fish,
<li>Eat the fish

Step 1 may take quite a while. The 3<sup>rd</sup> step smells the

This works fine until the document is presented to a user who
specifies that OL.LI elements are to be rendered alphabetically.

A related problem arises when trying to maintain references into long
lists. Item 27 today may be 28 tomorrow, and there is no easy way to
tell when the insertion of a LI element will render cross references


Add a new XREF element with the following definition:

<!ELEMENT XREF - O EMPTY -- Cross reference -->
to IDREF #REQUIRED -- ID of referenced item --
form (cardinal|ordinal) cardinal -- Format of reference --

The preceding example then becomes

<li ID="fish.catch">Catch the fish,
<li>Clean the fish,
<li ID="fish.cook">Cook the fish,
<li>Eat the fish

Step <XREF TO="fish.catch"> may take quite a while. The
<XREF TO="fish.cook" FORM=ordinal> step smells the best.

A browser will render an XREF by using the number of the element
associated with the referenced ID, possibly modulated by the XREF's
CLASS and LANG attributes, which may, for example, be specified in a
style sheet to request that the number be spelled out as "one"/"first"
A browser may also be configured to automatically insert a hypertext
link for XREF elements (if not already inside an <A> element).

When an element is referenced which is potentially numbered (such as
LI or H2) but whose numbering style does not actually display a
number, the browser should choose (or allow the style sheet and/or
user to specify) a default format. The one used for un-CLASS-ed OLs
would probably be a good backup choice. Alternatively, this case
could be (user-specified to be) handled as below.

When an element is referenced which is unnumbered, the browser should
display the fact with an icon or other such notation and should
probably place a hypertext link to the referenced element.


This proposal introduces the following difficulties

1. The browser must remember the number associated with each
numbered entity which has an ID attribute.

2. The browser must be prepared to handle XREF elements pointing to
elements which have not yet been seen or which remain undefined.
In this case it should either delay layout until the appropriate
element has been seen (or the end of the document is reached) or
be prepared to backpatch and reformat the paragraph containing
the XREF when the referenced element is seen.

3. It remains to be defined what a good default is for ordinal
references to numbers which are nested. Probably this should be
only the innermost number and used

the <xref to=a form=ordinal> point of step <xref to=b> shows...

4. It is unclear how this scheme generalizes to cross-references to
other documents.


Evan Kirshenbaum +------------------------------------
HP Laboratories |When you rewrite a compiler from
1500 Page Mill Road, Building 4A |scratch, you sometimes fix things
Palo Alto, CA 94304 |you didn't know were broken.
| Larry Wall