White Papers/Unique Footnotes

From Docs

Jump to: navigation, search

Get PDF

Contents

Unique Footnotes

Unique Footnotes is when several footnotes of the same meaning are defined on a page, and their inlines are placed properly in the main text, but their bodies collapse to just one such body.

The User's Request

Imagine you are creating a list of your customers for your new secretary, describing there full names, addresses, phone numbers, companies they work for etc. The list is sorted alphabetically. Some of the customers are of the most importance, and you want them be rendered with an asterisk after the name, e.g. "John S. Smith *", and the asterisk is in fact a footnote, which always reads like "This is a VIP customer. If he calls and wants the Director, do connect".

When you get it printed, you notice that on some pages there are no footnotes at all, some other pages have one footnote of this kind, but a few other pages have two or more identical footnotes, which looks bad and wastes the trees.

You wish to have not more than one footnote-body of this kind on a page. Unfortunately, neither version of XSL FO specification provides a tool for this. Well, you could do this manually, by removing the content of footnote-bodies for those footnotes that happened to be not the first ones on each page. This is possible, but dull work, and it will be void once you get a new customer.

We have had plenty of user requests for this feature while doing support for XEP.

The Solution

DiType comes up with a very simple solution: for all footnotes of the same meaning, place the same id attribute on their footnote-bodies. DiType will render only one footnote-body with the same id on a page. Yes, it violates the XML Spec, but the parsers and style-sheets used in DiType do not check for referential integrity for @id's.

There is a deeper sight on using the attribute id for this purpose. If two elements in an XML document have the same values of their id attributes, it means that they are actually the same element, or, at least, that they originate from the same element. In the [attachment:uc-uniq-footnotes.xml example] there is a single named template that creates the footnote, independent of the node it was invoked on. This template generates the same footnote-body/@id every time it is called.

An Example

A small example demonstrating this feature in action is attached to this page:

Notes

Two things must be taken into account by users who employ this hack.

First. If a footnote-body with a specific id starts on the previous page and ends on the current page, it will not be counted as the first footnote with this id on the current page. Thus, for a tall footnote-body, you may get a tail and the whole such body on a page.

Second. Once the first footnote-body with a specific id is found and rendered on a page, all the rest footnote-bodies with the same id on this page will be completely discarded, as if they were not specified at all. If some of those discarded bodies contained an anchor (a term for the Index, a target for a link etc.) or one part of pairing elements (a change-bar-begin/end or rx:begin/end-index-range), the corresponding Index or link or range (change-range or index-range) will fail, but DiType itself will not crash, of course.

That's it. Thanks to David Tolpin for inventing and implementing this useful feature.

Michael Sulyaev

Personal tools