docbook-apps

  • 1.  Problem customizing appendix title (for PDF)

    Posted 03-08-2015 21:29
    Hi all,

    I want the label of an appendix in an article to show up in a final PDF
    as follows:

    Bijlage 1. SomeDutchTitle

    (The word "Bijlage" is Dutch for "Appendix".)

    So the text "Bijlage" is to be prepended to the appendix number.

    Chapter 9 of the book "Docbook XSL, The complete
    Guide", pages 105 and 106, covers this customization. Or online:

    http://www.sagehill.net/docbookxsl/CustomGentext.html

    It reads:

    <l:context name="title">
    <l:template name="appendix" text="Appendix %n. %t"/>
    ...

    Below, you find a minimal docbook xml source. Also a minimal docbook xsl
    file, analogous to the above customization in English, which I applied
    using xsltproc. Finally, I used fop to generate
    the final PDF (which seems to me irrelevant to the issue).

    I fail to produce output that has *any* text prepended to the appendix's
    number (i.e. even regardless the Dutch language).

    Does anybody see what I'm doing wrong?

    Thanks in advance for any insight,

    Erik Leunissen
    --

    # Docbook XML source

    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:svg="http://www.w3.org/2000/svg"
    xmlns:m="http://www.w3.org/1998/Math/MathML"
    xmlns:html="http://www.w3.org/1999/xhtml"
    xmlns:db="http://docbook.org/ns/docbook">
    <info>


    <author>

    <personname><firstname>Erik</firstname><surname>Leunissen</surname></personname>

    <affiliation>
    <orgname/>
    </affiliation>
    </author>

    <pubdate/>
    </info>




    <para>Some section text.</para>


    <appendix>


    <para/>
    </appendix>


    --
    # Docbook XSL

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    xmlns:d="http://docbook.org/ns/docbook"
    exclude-result-prefixes="d"
    version="1.0">


    <xsl:import
    href="/usr/share/xml/docbook/stylesheet/nwalsh/docbook-xsl-ns/fo/docbook.xsl"/>

    <xsl:param name="appendix.autolabel" select="1"/>
    <xsl:param name="l10n.gentext.language">nl</xsl:param>
    <xsl:param name="local.l10n.xml" select="document('')"/>
    <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
    <l:l10n language="nl">
    <l:context name="title">
    <l:template name="appendix" text="Bijlage %n.  %t"/>
    </l:context>
    </l:l10n>
    </l:i18n>

    </xsl:stylesheet>

    --



  • 2.  Re: [docbook-apps] Problem customizing appendix title (for PDF)

    Posted 03-08-2015 21:42
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Dne 8.3.2015 v 22:29 Erik Leunissen napsal(a):
    > Below, you find a minimal docbook xml source. Also a minimal
    > docbook xsl file, analogous to the above customization in English,
    > which I applied using xsltproc. Finally, I used fop to generate the
    > final PDF (which seems to me irrelevant to the issue).
    >
    > I fail to produce output that has *any* text prepended to the
    > appendix's number (i.e. even regardless the Dutch language).
    >
    > Does anybody see what I'm doing wrong?

    Put the <l:i18n> section into a separate XML file (e.g. l10n-data.xml)
    and link to it using the local.l10n.xml parameter like this:

    <xsl:param name="local.l10n.xml" select="document('l10n-data.xml')"/>
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2

    iQEcBAEBAgAGBQJU/MINAAoJEETC23Hm5VDdLXIIAKgWlX0GA5/9leh0pNLnWuUo
    zA+zHatwuuikmSYzQvJJ09/TT7dwTSiNwz1UqXSiifBP+3bK4ba+H1ZmMpUaSf25
    pxCHoDq3xuLe1vOyAXsyp3Fd5zabdK0mu97Z2slqwmkvbVDyPAObDn0CkXaVbZsy
    salwSyRMZNgILblZ6beQ8aDEonKOXuy/+aHUI+nSbdvqfaTMxWDLdxv9FYsJDq0E
    fnBy4j5499zud6/y/pZ6v5W5oNc8T5eq0/4i64E9MSHq4fAMhIAun09eaTp+Lnv7
    jl+BebEq1Daw8dxVlBeAd+j/2OocaszP6P/M93pnJ+LCtY1Ag2+jZuKoFDNovKs=
    =JFdG
    -----END PGP SIGNATURE-----



  • 3.  Re: [docbook-apps] Problem customizing appendix title (for PDF)

    Posted 03-09-2015 16:29
    On 08/03/15 22:41, Martin Doucha wrote:
    > ...
    > Put the <l:i18n> section into a separate XML file (e.g. l10n-data.xml)
    > and link to it using the local.l10n.xml parameter like this:
    >
    > <xsl:param name="local.l10n.xml" select="document('l10n-data.xml')"/>
    > ...

    Thanks Martin,

    I did that. The PDF output (and the FO output likewise) still shows a
    mere "1." as the appendix's label. No text is prepended.

    Does it work for you?

    Greetings,

    Erik.




  • 4.  Re: [docbook-apps] Problem customizing appendix title (for PDF)

    Posted 03-09-2015 06:55
    Hi Erik,

    On Sun, 08 Mar 2015 22:29:12 +0100
    Erik Leunissen <elns@xs4all.nl> wrote:

    > I want the label of an appendix in an article to show up in a final
    > PDF as follows:
    >
    > Bijlage 1. SomeDutchTitle
    > [...]
    > # Docbook XML source
    >
    >
    > xmlns:xlink="http://www.w3.org/1999/xlink"
    > xmlns:xi="http://www.w3.org/2001/XInclude"
    > xmlns:svg="http://www.w3.org/2000/svg"
    > xmlns:m="http://www.w3.org/1998/Math/MathML"
    > xmlns:html="http://www.w3.org/1999/xhtml"
    > xmlns:db="http://docbook.org/ns/docbook">

    You are missing the important xml:lang attribute in your root element.
    Without that attribute, all generated texts are created in English by
    default. Add the line

    xml:lang="nl"

    into your article without using any customization layer at all. Rebuild
    your document and check it. :)


    --
    Gruß/Regards,
    Thomas Schraitle



  • 5.  Re: [docbook-apps] Problem customizing appendix title (for PDF)

    Posted 03-09-2015 16:29
    On 09/03/15 07:55, Thomas Schraitle wrote:
    >...
    > You are missing the important xml:lang attribute in your root element.
    > Without that attribute, all generated texts are created in English by
    > default. Add the line
    >
    > xml:lang="nl"
    >
    > into your article without using any customization layer at all. Rebuild
    > your document and check it. :)
    > ...

    Thanks Thomas,

    I did that.

    Like Martin's suggestion, the PDF output (and the FO output likewise)
    still shows a mere "1." as the appendix's label. No text is prepended.

    Does it work for you?

    Greetings,

    Erik.




  • 6.  Re: [docbook-apps] Problem customizing appendix title (for PDF)

    Posted 03-09-2015 17:08
    On 08/03/15 22:29, Erik Leunissen wrote:
    > ...
    > So the text "Bijlage" is to be prepended to the appendix number.
    > ...

    Such prepended text doesn't even I show up in my output if I apply just
    the stock stylesheets without any customization at all.

    Am I right that prepending text, like "Appendix" to the appendix nr. is
    the default behaviour? (That's what I deduce from:

    http://www.sagehill.net/docbookxsl/CustomGentext.html )

    Could somebody please verify that?

    If so, this issue is not related to customization.

    Another reason to suggest this is that I manage perfectly well to
    customize the label of section titles (using the i18n or i10n
    customizations as shown before), but not appendix titles.

    Greetings,

    Erik.




  • 7.  Solved [was Problem customizing appendix title (for PDF)]

    Posted 03-09-2015 17:28
    On 09/03/15 18:08, Erik Leunissen wrote:
    > On 08/03/15 22:29, Erik Leunissen wrote:
    >> ...
    >> So the text "Bijlage" is to be prepended to the appendix number.
    >> ...
    >
    > Such prepended text doesn't even I show up in my output if I apply just
    > the stock stylesheets without any customization at all.
    >
    > Am I right that prepending text, like "Appendix" to the appendix nr. is
    > the default behaviour? (That's what I deduce from:
    >

    Yes it is, but:

    it is not for appendices inside articles, which have a special
    setting by default, to show no prepended text. See common/en.xml:

    <l:context name="title-numbered">
    <l:template name="appendix" text="Appendix %n. %t"/>
    <l:template name="article/appendix" text="%n. %t"/> <== ***

    </l:context>


    This also leads the way to the correct customization for my case:

    <l:template name="article/appendix" text="Bijlage %n. %t"/>


    Greetings,

    Erik.


    > http://www.sagehill.net/docbookxsl/CustomGentext.html )
    >
    > Could somebody please verify that?
    >
    > If so, this issue is not related to customization.
    >
    > Another reason to suggest this is that I manage perfectly well to
    > customize the label of section titles (using the i18n or i10n
    > customizations as shown before), but not appendix titles.
    >
    > Greetings,
    >
    > Erik.
    >
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >