The Footnote Pattern is used when running text refers to an external note or annotation that is displayed in a separate flow and linked by a symbol such as a number.
The Footnote Pattern has three participants:
A given piece of running text can use the Footnote Pattern any number of times, but within each instance of the pattern, there is a single footnote body.
A Footnote Reference is marked up as an EMPTY element carrying an attribute of type IDREF:
<!ELEMENT FootnoteReference EMPTY > <!ATTLIST FootnoteReference NoteRef IDREF #REQUIRED >
A Footnote Body generally contains Running Text, with an ID-valued attribute to enable an XML processor to associate it with the NoteRef on the correct Footnote Reference elements:
<!ELEMENT FootnoteBody (%RunningText;)* > <!ATTLIST FootnoteBody ID ID #REQUIRED >
The assumption is that a footnote marker will be automatically generated. Note that since the Footnote Body contains Running Text, the Footnote Body may itself contain footnote references either to itself or to other Footnote Bodies.
Formatting software for printed output generally has to see each Footnote Body as soon as, or before, it is referenced, so as to determine whether there is space on the page for both the footnote and the running text containing the reference. This usually means using two passes over the input, reading the entire input into memory, or forcing every Footnote Body element to occur before the first reference to it.
Formatting software for the screen may simply need to save each Footnote Body into a separate file and arrange for a pop-up window to be displayed when the marker is activiated. A variation for short footnotes on the Web might be to generate fly-by windows that pop up when the mouse pointer hovers over the Footnote Reference, rather like ALT text on an image.
It may be useful to store a footnote marker in a footnote reference element. This may simplify formatting at the expense of introducing a possible integrity problem if two footnote references point to the same footnote body but use different markers, or if the marker in the footnote reference is not the same as the marker in the footnote body.
Two ways to do this are (1) to give the Footnote Reference element an attribute for the marker, or (2) to let the marker be the content of the Footnote Reference element. The second choice works better if the marker might contain elements such as superscript or font control markup.
It is sometimes convenient to process an XML document automatically to generate Footnote Reference Markers, and in this case it makes sense to include the automatically generated marker as content.
<!ELEMENT FootnoteReference (#PCDATA) > <!ATTLIST FootnoteReference NoteRef IDREF #REQUIRED >