[xep-support] Order of unique footnotes

Alexei Gagarinov agagarinov at renderx.com
Tue Jun 17 20:43:33 PDT 2008

Hi Krister,

> You can see on page two in the PDF that the footnotes are in the order they 
> appear in the content file.

This is the exact behavior prescribed by XSL-FO Specification and the 
only reasonable way of placing footnotes in general.

A "strange" order of footnote descriptions is any other one, imo.

> My customer want the footnote to be in number order instead.

One of the solutions is to try to convince your customer that the 
observed behavior is natural. :)

Another solution is to reorder footnotes (I mean footnote bodies) on 
XSLT level.

The main idea is the following:
1) Sort the footnote bodies from each page in the desired order and 
place these "fake" footnotes (i.e. footnotes bodies without anchors) on 
the very beginning of each page.
2) The actual footnotes should contain only anchors (fo:inline).

The problem with this approach is that one doesn't know how footnotes 
are split across page boundaries before formatting (due to the nature of 
XSL-FO technology).

But the above idea along with the RenderX extension for unique footnotes 
provide the desired result:
Each footnote in the document (optimization: in a page-sequence) have 
its own anchor with the empty body and the sorted list of "fake" bodies 
including its own body.
The bodies should carry the correct @id attribute, of course.
All "superfluous" bodies will be merged with each other during 
formatting and you will see the unique footnotes only.
The sorted list of "fake" bodies (of the current and all subsequent - 
according to the document order - footnotes) on each footnote makes it 
unimportant where a page breaks.

I attached the modified XSL file with the described approach.
The XSLT code is not optimized and not elegant, but it works. :)

Best regards,
   Alexei Gagarinov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: template.xsl
Type: text/xml
Size: 3088 bytes
Desc: not available
URL: <http://lists.renderx.com/pipermail/xep-support/attachments/20080618/48913b01/attachment.xml>

More information about the Xep-support mailing list