docbook-apps

  • 1.  RE: [docbook] para customization affects footnote numbers

    Posted 08-22-2010 13:56
    Hi Sharon,
    I had the very same problem long ago and was helped by Bob Stayton on the docbook-apps mailing list:

    "This is one of the gotchas of XSL import precedence. This template in fo/footnote.xsl:

    <xsl:template match="footnote/para[1]
    |footnote/simpara[1]
    |footnote/formalpara[1]"
    priority="2">

    which generates the superscript in the para fo:block is being overridden by your customization of para. A template match with a higher import precedence will always be used before a template of lower import precedence, even if that has a better match and higher priority. So you need to copy this template to your customization layer to raise its import precedence, or change your match attribute in your customization to exclude footnote parents:

    match="para[not(parent::footnote)]"

    So you'll want to change:

    <xsl:template match="para">

    To

    <xsl:template match="para[not(parent::footnote)]">

    And all should be well.

    Btw., I've replied to the docbook-apps list. The docbook list is for questions about what markup to use and the DocBook schema while docbook-apps is for questions about the stylesheets and other matters of DocBook processing. I'm getting a blank page for that oasis list guidelines page as well. No idea what's up with that.

    David


    From: Sharon Lifshitz [mailto:sharon.l.mail@gmail.com]
    Sent: Sunday, August 22, 2010 6:06 AM
    To: docbook@lists.oasis-open.org
    Subject: [docbook] para customization affects footnote numbers

    Hello,

    After redefining the para template from nwalsh/fo/block.xsl, in order to support and additional attribute, I noticed that this affected the usage of para within footnote tags -- the footnote number in the print (PDF) output no longer appeared in the footnotes section (i.e., the footnote appeared without its number); the number did appear in the footnote reference within the text.

    For test purposes, I tried copying the original para template definition, as-is, into my print style sheet, and the result was the same.
    (None of the footnote formatting parameters are set in my style sheets -- i.e., I'm using the default formatting.)

    The copied para template:
    ====================
    <xsl:template match="para">
    <xsl:variable name="keep.together">
    <xsl:call-template name="pi.dbfo_keep-together"/>
    </xsl:variable>
    <fo:block xsl:use-attribute-sets="normal.para.spacing">
    <xsl:if test="$keep.together != ''">
    <xsl:attribute name="keep-together.within-column"><xsl:value-of
    select="$keep.together"/></xsl:attribute>
    </xsl:if>
    <xsl:call-template name="anchor"/>
    <xsl:apply-templates/>
    </fo:block>
    </xsl:template>
    ====================

    What am I missing?

    P.S. I tried to read the mailing list guidelines at http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=docbookguidelines.html (linked from http://wiki.docbook.org/topic/DocBookMailingList) but the page was not found?

    Thanks,
    Sharon



  • 2.  Re: [docbook] para customization affects footnote numbers

    Posted 08-24-2010 13:25
    Hello David,

    Thank you very much for your prompt and informative reply.

    I changed the template definition to exclude footnote parents, as you
    suggested -- <xsl:template match="para[not(parent::footnote)]"> -- and it
    worked like a charm[?].

    Thank you also for the information regarding the mailing lists.

    Sharon

    On Sun, Aug 22, 2010 at 4:56 PM, Cramer, David W (David) <dcramer@motive.com
    > wrote:

    > Hi Sharon,
    >
    > I had the very same problem long ago and was helped by Bob Stayton on the
    > docbook-apps mailing list:
    >
    >
    >
    > “This is one of the gotchas of XSL import precedence. This template in
    > fo/footnote.xsl:
    >
    >
    >
    > <xsl:template match="footnote/para[1]
    >
    > |footnote/simpara[1]
    >
    > |footnote/formalpara[1]"
    >
    > priority="2">
    >
    >
    >
    > which generates the superscript in the para fo:block is being overridden by
    > your customization of para. A template match with a higher import
    > precedence will always be used before a template of lower import precedence,
    > even if that has a better match and higher priority. So you need to copy
    > this template to your customization layer to raise its import precedence, or
    > change your match attribute in your customization to exclude footnote
    > parents:
    >
    >
    >
    > match="para[not(parent::footnote)]"
    >
    >
    >
    > So you’ll want to change:
    >
    >
    >
    > <xsl:template match="para">
    >
    >
    >
    > To
    >
    >
    >
    > <xsl:template match="para[not(parent::footnote)]">
    >
    >
    >
    > And all should be well.
    >
    >
    >
    > Btw., I’ve replied to the docbook-apps list. The docbook list is for
    > questions about what markup to use and the DocBook schema while docbook-apps
    > is for questions about the stylesheets and other matters of DocBook
    > processing. I’m getting a blank page for that oasis list guidelines page as
    > well. No idea what’s up with that.
    >
    >
    >
    > David
    >
    >
    >
    >
    >
    > *From:* Sharon Lifshitz [mailto:sharon.l.mail@gmail.com]
    > *Sent:* Sunday, August 22, 2010 6:06 AM
    > *To:* docbook@lists.oasis-open.org
    > *Subject:* [docbook] para customization affects footnote numbers
    >
    >
    >
    > Hello,
    >
    > After redefining the para template from nwalsh/fo/block.xsl, in order to
    > support and additional attribute, I noticed that this affected the usage of
    > para within footnote tags -- the footnote number in the print (PDF) output
    > no longer appeared in the footnotes section (i.e., the footnote appeared
    > without its number); the number did appear in the footnote reference within
    > the text.
    >
    > For test purposes, I tried copying the original para template definition,
    > as-is, into my print style sheet, and the result was the same.
    > (None of the footnote formatting parameters are set in my style sheets --
    > i.e., I'm using the default formatting.)
    >
    > The copied para template:
    > ====================
    > <xsl:template match="para">
    > <xsl:variable name="keep.together">
    > <xsl:call-template name="pi.dbfo_keep-together"/>
    > </xsl:variable>
    > <fo:block xsl:use-attribute-sets="normal.para.spacing">
    > <xsl:if test="$keep.together != ''">
    > <xsl:attribute name="keep-together.within-column"><xsl:value-of
    > select="$keep.together"/></xsl:attribute>
    > </xsl:if>
    > <xsl:call-template name="anchor"/>
    > <xsl:apply-templates/>
    > </fo:block>
    > </xsl:template>
    > ====================
    >
    > What am I missing?
    >
    > P.S. I tried to read the mailing list guidelines at
    > http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=docbookguidelines.html(linked from
    > http://wiki.docbook.org/topic/DocBookMailingList) but the page was not
    > found?
    >
    > Thanks,
    > Sharon
    >