docbook-apps

  • 1.  space between chapter number and chapter text?

    Posted 11-11-2009 09:16
    Hi!

    In my customization layer I changed the chapter titles as follows:

    <xsl:param name="local.l10n.xml" select="document('')"/>
    <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
    <l:l10n language="de">
    <l:context name="title-numbered">
    <l:template name="chapter" text="%n %t"/>
    </l:context>
    </l:l10n>
    </l:i18n>

    I did this to get rid of the word "Kapitel" in the German chapter title. This work fine. So I get chapter titles in the form "number and text" now.

    My question: Is it possible to change the amount of space between the number and the text? I tried to insert additional space characters between the %n and the %t, but this had no effect at all.

    In my final layout I intend to have something like this:

    1 title chapter one
    1.1 title section level one
    1.1.1 title section level two

    with all the texts starting at the same distance from the left border of the paper.

    Is this possible?

    Johannes




  • 2.  Re: [docbook-apps] space between chapter number and chapter text?

    Posted 11-11-2009 14:24
    OK - I found a solution myself. I don't know if this is the best way to do it, but it works fine for me.
    In case somebody is interested in my solution, here it is:

    Change the customization layer for the chapter and section titles as follows:

    <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
    <l:l10n language="de">
    <l:context name="title-numbered">
    <l:template name="chapter" text="%n|%t"/>
    <l:template name="sect1" text="%n|%t"/>
    <l:template name="sect2" text="%n|%t"/>
    </l:context>
    </l:l10n>
    </l:i18n>

    This adds a pipe character as a separator between the chapter or section number and the text.

    Copy the template "component.title" to the customization layer stylesheet and modify the end of this template as follows:

    <xsl:otherwise>




    <fo:inline>
    <xsl:copy-of select="substring-before($title,'|')"/>
    </fo:inline>
    <fo:inline space-start="15mm">
    <xsl:copy-of select="substring-after($title,'|')"/>
    </fo:inline>
    </xsl:otherwise>

    Copy the template "section.heading" to the customization layer stylesheet and modify as follows:

    <xsl:choose>
    <xsl:when test="$level=1">
    <fo:block xsl:use-attribute-sets="section.title.level1.properties">



    <fo:inline>
    <xsl:copy-of select="substring-before($title,'|')"/>
    </fo:inline>
    <fo:inline space-start="11.5mm">
    <xsl:copy-of select="substring-after($title,'|')"/>
    </fo:inline>
    </fo:block>
    </xsl:when>
    <xsl:when test="$level=2">
    <fo:block xsl:use-attribute-sets="section.title.level2.properties">



    <fo:inline>
    <xsl:copy-of select="substring-before($title,'|')"/>
    </fo:inline>
    <fo:inline space-start="10mm">
    <xsl:copy-of select="substring-after($title,'|')"/>
    </fo:inline>
    </fo:block>
    </xsl:when>

    Yes, the space between the number and the text is hard-coded and this will break, if the font sizes for chapter and section titles are changed.
    A better solution would be to position the title text relative to the left border of the page. But I don't know how to do this.

    Johannes

    Am 11.11.2009 um 10:16 schrieb Johannes Katelaan:

    > Hi!
    >
    > In my customization layer I changed the chapter titles as follows:
    >
    > <xsl:param name="local.l10n.xml" select="document('')"/>
    > <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
    > <l:l10n language="de">
    > <l:context name="title-numbered">
    > <l:template name="chapter" text="%n %t"/>
    > </l:context>
    > </l:l10n>
    > </l:i18n>
    >
    > I did this to get rid of the word "Kapitel" in the German chapter title. This work fine. So I get chapter titles in the form "number and text" now.
    >
    > My question: Is it possible to change the amount of space between the number and the text? I tried to insert additional space characters between the %n and the %t, but this had no effect at all.
    >
    > In my final layout I intend to have something like this:
    >
    > 1 title chapter one
    > 1.1 title section level one
    > 1.1.1 title section level two
    >
    > with all the texts starting at the same distance from the left border of the paper.
    >
    > Is this possible?
    >
    > Johannes
    >
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >