Bug 565903 - Footnotes not numbered in PDF output
Footnotes not numbered in PDF output
Status: CLOSED ERRATA
Product: Publican
Classification: Community
Component: publican (Show other bugs)
1.6
All Linux
low Severity medium
: ---
: ---
Assigned To: Jeff Fearn
Fedora Extras Quality Assurance
: Regression, Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-02-16 11:53 EST by Jared Smith
Modified: 2010-11-23 23:18 EST (History)
5 users (show)

See Also:
Fixed In Version: publican-2.2-0.fc13
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-10-08 16:41:58 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
PDF output (132.16 KB, application/pdf)
2010-02-16 11:53 EST, Jared Smith
no flags Details
PDF output using stock stylesheet (6.90 KB, application/pdf)
2010-02-17 10:13 EST, Jared Smith
no flags Details

  None (edit)
Description Jared Smith 2010-02-16 11:53:09 EST
Created attachment 394585 [details]
PDF output

Description of problem:

For some reason, the footnotes at the bottom of the page aren't being numbered in the PDF output.

Version-Release number of selected component (if applicable):

[root@hockey ~]# rpm -q publican
publican-1.4-1.fc12.noarch
[root@hockey ~]# rpm -q --verify publican
[root@hockey ~]# 

How reproducible:

Always

Steps to Reproduce:
1. pushd /tmp
2. publican create --name FootnoteTest
3. cd FootnoteTest
4. Add the following text to the end of line 19 of en-US/Chapter.xml

<footnote><para>Testing!</para></footnote>

5. publican build --formats=html-single,pdf --langs=en-US
6. Notice that the footnotes appear correctly in the HTML version
7. Open the PDF version and notice that the footnotes at the bottom of the page don't have a number to identify which footnote is which. 
8. popd

Actual results:

Footnotes appear at the bottom of the PDF output without numbering

Expected results:

Footnotes at the bottom of the page should have numbers to identify them

Additional info:

I tried this with several brands (common, fedora, and my own brands) to see if it is a branding issue, but it doesn't appear to be, as I get the same output with all brands I try.
Comment 1 Jeff Fearn 2010-02-16 19:12:10 EST
This is the default behaviour of the DocBook FO style sheet. If you'd like this changed for the common brand please discuss it on the mail list.

If you'd like to change this in your own brand you could try this, untested, template in your brands pdf.xsl file.

<xsl:template match="footnote">
  <xsl:choose>
    <xsl:when test="ancestor::table or ancestor::informaltable">
      <xsl:call-template name="format.footnote.mark">
        <xsl:with-param name="mark">
          <xsl:apply-templates select="." mode="footnote.number"/>
        </xsl:with-param>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <fo:footnote>
        <fo:inline>
          <xsl:call-template name="format.footnote.mark">
            <xsl:with-param name="mark">
              <xsl:apply-templates select="." mode="footnote.number"/>
            </xsl:with-param>
          </xsl:call-template>
        </fo:inline>
        <fo:footnote-body xsl:use-attribute-sets="footnote.properties">
          <xsl:call-template name="format.footnote.mark">
            <xsl:with-param name="mark">
              <xsl:apply-templates select="." mode="footnote.number"/>
            </xsl:with-param>
          </xsl:call-template>
          <xsl:apply-templates/>
        </fo:footnote-body>
      </fo:footnote>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

The original template is in /usr/share/sgml/docbook/xsl-stylesheets-1.75.2/fo/footnote.xsl, you may need to xsl:import this in to your pdf.xsl file to satisfy dependencies.

Cheers, Jeff.
Comment 2 Jared Smith 2010-02-17 10:12:22 EST
(In reply to comment #1)
> This is the default behaviour of the DocBook FO style sheet. If you'd like this
> changed for the common brand please discuss it on the mail list.

Actually, this isn't true.  I took Chapter.xml from my Publican document and processed it directly with the default DocBook FO stylesheet:

pushd /tmp
cp FootnoteTest/en-US/Chapter.xml .
xsltproc /usr/share/sgml/docbook/xsl-stylesheets/fo/docbook.xsl Chapter.xml > Chapter.fo
fop -fo Chapter.fo -pdf Chapter.pdf

In this case, the number *does* appear in front of the footnote body.  (I'll attach this PDF as well.)

> If you'd like to change this in your own brand you could try this, untested,
> template in your brands pdf.xsl file.

That got me closer, but there were a couple of minor issues with that template, and I was able to fix those, but then my formatting was off.  I'll keep playing with this as time permits and see if I can't come up with a solution.
Comment 3 Jared Smith 2010-02-17 10:13:21 EST
Created attachment 394742 [details]
PDF output using stock stylesheet

This is the PDF generated by the system default stylesheet, not using Publican at all.
Comment 4 Jeff Fearn 2010-02-20 18:56:07 EST
Took a while to figure this out, it's to do with the way xsl:import handles precedence and the fact that we override the para template.

Added include for default footnote.xsl to get correct precedence.

$ svn diff datadir/xsl/pdf.xsl 
Index: datadir/xsl/pdf.xsl
===================================================================
--- datadir/xsl/pdf.xsl	(revision 1031)
+++ datadir/xsl/pdf.xsl	(working copy)
@@ -33,6 +33,8 @@
 
 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/graphics.xsl"/>
+<!-- This is required to get footnotes to format correctly due to overriding para BZ #565903 -->
+<xsl:include href="http://docbook.sourceforge.net/release/xsl/current/fo/footnote.xsl"/>
 <xsl:include href="defaults.xsl"/>
Comment 5 Fedora Update System 2010-02-26 00:25:08 EST
publican-1.5-0.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/publican-1.5-0.fc12
Comment 6 Fedora Update System 2010-02-26 00:28:56 EST
publican-1.5-0.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/publican-1.5-0.fc13
Comment 7 Fedora Update System 2010-02-26 00:29:12 EST
publican-1.5-0.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/publican-1.5-0.fc11
Comment 8 Fedora Update System 2010-02-26 00:29:16 EST
publican-1.5-0.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/publican-1.5-0.fc12
Comment 9 Fedora Update System 2010-02-26 00:31:32 EST
publican-1.5-0.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/publican-1.5-0.fc13
Comment 10 Fedora Update System 2010-02-26 00:35:24 EST
publican-1.5-0.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/publican-1.5-0.fc11
Comment 11 Fedora Update System 2010-02-26 22:29:45 EST
publican-1.5-0.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 12 Fedora Update System 2010-02-26 22:45:31 EST
publican-1.5-0.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 13 Jared Smith 2010-07-22 18:38:05 EDT
This problem has come back for me in publican-2.1-0.fc13.noarch, and someone else is reporting it in publican-1.6.2 as well.

Follow my "Steps to Reproduce" above with Publican 2.1, and you'll see there is no number in front of the footnote again.
Comment 14 Josh 2010-07-27 22:35:28 EDT
I was able to work around this bug with the following bit of xml in my brand pdf.xsl file.  Based on what I encountered while developing this, I believe the problem stems from customizing the properties for footnotes.  The biggest change is that I added the footnote.number in to the <xsl:otherwise> portion and I used the value-of instead of apply-templates.  Otherwise it was copied from footnote.xsl

Caveat:  I am terrible at this and the code is fugly, feel free to help me clean it up ;-)

<xsl:template match="footnote">
  <xsl:choose>
    <xsl:when test="ancestor::table or ancestor::informaltable">
      <xsl:call-template name="format.footnote.mark">
        <xsl:with-param name="mark">
          <xsl:apply-templates select="." mode="footnote.number"/>
        </xsl:with-param>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <fo:footnote>
        <fo:inline>
          <xsl:call-template name="format.footnote.mark">
            <xsl:with-param name="mark">
              <xsl:apply-templates select="." mode="footnote.number"/>
            </xsl:with-param>
          </xsl:call-template>
        </fo:inline>
        <fo:footnote-body xsl:use-attribute-sets="footnote.properties">
          <fo:block>
            <!-- this gets the footnote number-->
              <xsl:call-template name="format.footnote.mark">
                <xsl:with-param name="mark">
                  <xsl:apply-templates select="." mode="footnote.number"/>
                </xsl:with-param>
              </xsl:call-template>
            <xsl:value-of select="." />
          </fo:block>
        </fo:footnote-body>
      </fo:footnote>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
<xsl:template match="footnote" mode="table.footnote.mode">
  <xsl:choose>
    <xsl:when test="local-name(*[1]) = 'para' or local-name(*[1]) = 'simpara'">
      <fo:block xsl:use-attribute-sets="table.footnote.properties">
        <xsl:call-template name="format.footnote.mark">
          <xsl:with-param name="mark">
            <xsl:apply-templates select="." mode="footnote.number"/>
          </xsl:with-param>
        </xsl:call-template>
        <xsl:value-of select="."/>
      </fo:block>
    </xsl:when>

    <xsl:when test="$exsl.node.set.available != 0">
      <fo:block xsl:use-attribute-sets="table.footnote.properties">
        <xsl:apply-templates select="*[1]" mode="footnote.body.number"/>
        <xsl:apply-templates select="*[position() &gt; 1]"/>
      </fo:block>
    </xsl:when>

    <xsl:otherwise>
      <xsl:message>
        <xsl:text>Warning: footnote number may not be generated </xsl:text>
        <xsl:text>correctly; </xsl:text>
        <xsl:value-of select="local-name(*[1])"/>
        <xsl:text> unexpected as first child of footnote.</xsl:text>
      </xsl:message>
      <fo:block xsl:use-attribute-sets="table.footnote.properties">
        <xsl:apply-templates/>
      </fo:block>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Comment 15 Jeff Fearn 2010-07-28 00:57:08 EDT
This is because footnote.xsl was being imported instead of included.

Switched back to include, added note to not switch to import.

Fixed in build: 2.1-0%{?dist}.t3
Comment 16 Josh 2010-07-28 08:42:26 EDT
(In reply to comment #15)
> This is because footnote.xsl was being imported instead of included.
> 
> Switched back to include, added note to not switch to import.
> 
> Fixed in build: 2.1-0%{?dist}.t3    

confirmed that using a include instead of import fixes it in a 1.6.2 brand
Comment 17 Ruediger Landmann 2010-08-05 23:49:16 EDT
Confirmed fixed in 2.1.t20
Comment 18 Fedora Update System 2010-10-05 23:05:51 EDT
publican-2.2-0.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/publican-2.2-0.fc13
Comment 19 Fedora Update System 2010-10-05 23:06:11 EDT
publican-2.2-0.fc12 has been submitted as an update for Fedora 12.
https://admin.fedoraproject.org/updates/publican-2.2-0.fc12
Comment 20 Fedora Update System 2010-10-05 23:06:33 EDT
publican-2.2-0.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/publican-2.2-0.fc14
Comment 21 Fedora Update System 2010-10-06 01:48:19 EDT
publican-2.2-0.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/publican-2.2-0.fc13
Comment 22 Fedora Update System 2010-10-06 01:49:36 EDT
publican-2.2-0.fc12 has been submitted as an update for Fedora 12.
https://admin.fedoraproject.org/updates/publican-2.2-0.fc12
Comment 23 Fedora Update System 2010-10-06 01:49:40 EDT
publican-2.2-0.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/publican-2.2-0.fc14
Comment 24 Fedora Update System 2010-10-08 16:39:44 EDT
publican-2.2-0.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.