OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Same font and color for specific titles


Hi Bob,
thank you so much for your detailed response.

I thought I had to write only one customization file containing all elements which should be changed.

I will follow the guideline/your suggestion to apply my customizations.


Best regards,
Peter

Am 30.04.2018 um 20:42 schrieb Bob Stayton:
Hi Peter,

The DocBook stylesheets were written in a manner to be as flexible and customizable as possible, and that had made them more complex. Sometimes there is more than one way to accomplish a purpose.

When Norm Walsh wrote the original stylesheets, he created a special customization method for titles and other title page information because there are so many elements that can have title pages and so many elements that can be included in a title page, and everyone wants them different.  His solution was to create an XML configuration file which appears in the distribution as titlepage.templates.xml.  The idea was to put all the formatting attributes in that spec file, and then apply a special stylesheet that generates an XSL module to be imported to your stylesheet.  Since you want to customize lots of titles, I suggest you pursue this method.  That's how the original titlepage.templates.xsl stylesheet module is generated.

The customization process is described in Chapter 11 of my book:

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

Although it was written for HTML, it applies to fo as well.  The basic steps are:

1. Copy fo/titlepage.templates.xml to a new location and customize it by adding your font color and any other attribute settings to the <title> elements inside it.

2. Process your customize spec file with template/titlepage.xsl as described in this section:

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

That generates a whole new set of titlepage XSL templates but including your changes.

3.  Add an xsl:import statement to your customization layer to pull in your XSL module as described in the section after that.

With this setup, you will no longer need to write customized XSL templates all those elements, they are all written for you in step 2.

Hope this helps.

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net

On 4/29/2018 10:27 PM, Peter Schmelzer wrote:
Hi Bob,
thanks for your reply,

I want to use Docbook 5.1 for technical desciptions. My editor is oygenXML (Webauthor). The main goal ist to produce PDF documents and maybe HTML documents for a website.

The font is working fine for book title, chapter, section, table of contents, table of figures, table of tables and appendix. The font color is *not* working for table of contents, table of figures, table of tables.

I'll check the stylesheet header for the DB5 changes as you suggested in your first link.

As I wrote at the beginning of my thread, I'm unable to reproduce the necessary steps to change the other component title color. I don't understand what I have to to. I've read your second link suggestion many times, but with no luck.

BTW: It's very hard to understand DocBooks stylesheets, but I'm sure that when the stylesheet is working as expected, it will same me hours of time... :-)


BR Peter


On 29.04.2018 21:08, Bob Stayton wrote:
Right, the very latest version 1.79.2 switches the names.

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net

On 4/29/2018 11:49 AM, Ron Catterall wrote:

Hasn't the 'ns' in the package name disappeared now:

docbook-xsl-1.79.2 gets the name space version.

need  a -nons to revert to non-namespace version

Ron


On 04/29/2018 01:40 PM, Bob Stayton wrote:

It isn't clear from your mail what's working and what is not. First question is whether your DocBook files are version 5 with the namespace or version 4 without the namespace.  If version 5, you should be using the namespaced version of the stylesheets (with "ns" in the package name), and you will have to add the namespace prefix to any element names in your stylesheet customization.  See:

http://www.sagehill.net/docbookxsl/Db5Tools.html#ConvertToDb5

It looks like you were able to change titles in book, chapter, and section, and it looks like you are missing customization of the 'component.title.properties' attribute set.  See:

http://www.sagehill.net/docbookxsl/TitleFontSizes.html#OtherComponentTitles

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
On 4/29/2018 9:35 AM, Peter Schmelzer wrote:
Hi,
I'm new to docbook.

I want to achieve that the following titles share the same font and font color: book titlepage, chapter, section, appendix, preface, article,              index, glossary, dedication, bibliography and colophon.

I've read the article http://www.sagehill.net/docbookxsl/TitleFontSizes.html but I'm unable to reproduce the explanations.

I've build my own customization stylesheet using information from various places. This is what I have now (shortened):
=========
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:fo="http://www.w3.org/1999/XSL/Format"; xmlns="http://docbook.org/ns/docbook";
    xmlns:d="http://docbook.org/ns/docbook"; version="1.0">
    <xsl:import href="https://cdn.docbook.org/release/xsl/current/fo/docbook.xsl"/>
    <!-- Standard Schriftgrösse -->
    <xsl:param name="body.font.master">11</xsl:param>
    <!-- Schriftart für Fliesstext ändern -->
    <xsl:param name="body.font.family">"Calibri"</xsl:param>
    <!-- Schriftart für Titel ändern -->
    <xsl:param name="title.font.family">"TrajanPro-Bold"</xsl:param>
    <!-- Farbe für Überschriften und Titel -->
    <xsl:param name="title.color">#014A78</xsl:param>
    <!-- Grafik für Kopfzeilen -->
    <xsl:param name="header.image.filename">../images/my.svg</xsl:param>
    <xsl:param name="toc.section.depth">2</xsl:param>
    <xsl:param name="insert.xref.page.number">0</xsl:param>
    <!--
        Voreinstellung: Seitenlayout
    -->
    <xsl:param name="page.orientation">portrait</xsl:param>
    <xsl:param name="page.height.portrait">297mm</xsl:param>
    <xsl:param name="page.width.portrait">210mm</xsl:param>
    <xsl:param name="page.margin.inner">20mm</xsl:param>
    <xsl:param name="page.margin.outer">15mm</xsl:param>
    <xsl:param name="page.margin.top">10mm</xsl:param>
    <xsl:param name="region.before.extent">17mm</xsl:param>
    <xsl:param name="body.margin.top">30mm</xsl:param>
    <xsl:param name="region.after.extent">15mm</xsl:param>
    <xsl:param name="page.margin.bottom">10mm</xsl:param>
    <xsl:param name="body.margin.bottom">22mm</xsl:param>
    <!-- Kein Einzug für Fliesstext -->
    <xsl:param name="body.start.indent">0pt</xsl:param>
    <!-- Lange Zeilen umbrechen (z.B. Listings) -->
    <xsl:param name="fop1.extensions">1</xsl:param>
    <xsl:param name="hyphenate">true</xsl:param>
    <xsl:param name="hyphenate.verbatim" select="1"/>
    <!-- Einseitige PDF Dokumente (Bildschirm) -->
    <xsl:param name="double.sided">0</xsl:param>
    <!--
        Voreinstellung: Kopfzeile
    -->
    <xsl:template name="header.content">
        <xsl:param name="pageclass" select="''"/>
        <xsl:param name="sequence" select="''"/>
        <xsl:param name="position" select="''"/>
        <xsl:param name="gentext-key" select="''"/>
        <fo:block>
            <!-- sequence can be odd, even, first, blank -->
            <!-- position can be left, center, right -->
            <xsl:choose>
                <xsl:when test="$sequence = 'blank'">
                    <!-- nothing -->
                </xsl:when>

                <xsl:when test="$position='left'">
                    <!-- Same for odd, even, empty, and blank sequences -->
                    <xsl:call-template name="draft.text"/>
                </xsl:when>

                <xsl:when test="($sequence='odd' or $sequence='even') and $position='center'">
                    <!-- nothing -->
                </xsl:when>

                <xsl:when test="$position='center'">
                    <!-- nothing for empty and blank sequences -->
                </xsl:when>

                <xsl:when test="$position='right'">
                    <!-- Same for odd, even, empty, and blank sequences -->
                    <!--<xsl:call-template name="draft.text"/>-->
                    <fo:external-graphic content-height="25mm">
                        <xsl:attribute name="src">
                            <xsl:call-template name="fo-external-image">                                 <xsl:with-param name="filename" select="$header.image.filename"/>
                            </xsl:call-template>
                        </xsl:attribute>
                    </fo:external-graphic>
                </xsl:when>

                <xsl:when test="$sequence = 'first'">
                    <!-- nothing for first pages -->
                </xsl:when>

                <xsl:when test="$sequence = 'blank'">
                    <!-- nothing for blank pages -->
                </xsl:when>
            </xsl:choose>
        </fo:block>
    </xsl:template>

    <!-- use corpauthor if applicable -->
    <xsl:template match="d:author" mode="book.titlepage.verso.mode">
        <xsl:apply-templates mode="titlepage.mode"/>
    </xsl:template>
    <!--
        Anpassung Schriftarten für Titel etc.
    -->
    <!-- Anpassung Schriftart für Titelseite -->
    <xsl:template match="d:title" mode="book.titlepage.recto.auto.mode">
        <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format";
xsl:use-attribute-sets="book.titlepage.recto.style" text-align="center" font-size="32pt"             space-before="18.6624pt" font-weight="bold" font-family="{$title.fontset}" color="{$title.color}">
            <xsl:call-template name="division.title">
                <xsl:with-param name="node" select="ancestor-or-self::d:book[1]"/>
            </xsl:call-template>
            <fo:block space-before="1em" space-after="1em">
                <fo:external-graphic src="../images/in2success.svg" content-height="50%"
                    scaling="uniform"/>
            </fo:block>
        </fo:block>
        <revhistory/>
    </xsl:template>
    <!-- Anpassung Schriftart für Kapitel -->
    <xsl:template match="d:title" mode="chapter.titlepage.recto.auto.mode">
        <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format";
xsl:use-attribute-sets="chapter.titlepage.recto.style" font-size="22pt"             font-weight="bold" space-after=".4in" color="{$title.color}">
            <xsl:call-template name="component.title">
                <xsl:with-param name="node" select="ancestor-or-self::d:chapter[1]"/>
            </xsl:call-template>
        </fo:block>
    </xsl:template>
    <!-- Anpassung Schriftart für Abschnittstitel Level 1 -->
    <xsl:attribute-set name="section.title.level1.properties">
        <xsl:attribute name="color">
            <xsl:value-of select="$title.color"/>
        </xsl:attribute>
        <xsl:attribute name="font-size">
            <xsl:value-of select="$body.font.master * 1.2"/>
            <xsl:text>pt</xsl:text>
        </xsl:attribute>
    </xsl:attribute-set>
    <!-- Anpassung Schriftart für Abschnittstitel Level 2 -->
    <xsl:attribute-set name="section.title.level2.properties">
        <xsl:attribute name="color">
            <xsl:value-of select="$title.color"/>
        </xsl:attribute>
        <xsl:attribute name="font-size">
            <xsl:value-of select="$body.font.master * 1.1"/>
            <xsl:text>pt</xsl:text>
        </xsl:attribute>
    </xsl:attribute-set>
    <!-- Anpassung Schriftart für Abschnittstitel Level 3 -->
    <xsl:attribute-set name="section.title.level3.properties">
        <xsl:attribute name="color">
            <xsl:value-of select="$title.color"/>
        </xsl:attribute>
        <xsl:attribute name="font-size">
            <xsl:value-of select="$body.font.master"/>
            <xsl:text>pt</xsl:text>
        </xsl:attribute>
    </xsl:attribute-set>
    <!-- Anpassung Schriftart für Anhang -->
    <xsl:template match="d:title" mode="appendix.titlepage.recto.auto.mode">
        <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format";
xsl:use-attribute-sets="appendix.titlepage.recto.style"
            margin-left="{$title.margin.left}" font-size="22pt" space-after=".4in"             font-weight="bold" font-family="{$title.fontset}" color="{$title.color}">
            <xsl:call-template name="component.title">
                <xsl:with-param name="node" select="ancestor-or-self::d:appendix[1]"/>
            </xsl:call-template>
        </fo:block>
    </xsl:template>
    <!-- Anpassung Schriftart für Inhaltsverzeichnis -->
    <xsl:template match="d:title" mode="index.titlepage.recto.auto.mode">
        <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format";
xsl:use-attribute-sets="index.titlepage.recto.style"
            color="{$title.color}">
            <xsl:call-template name="component.title">
                <xsl:with-param name="node" select="ancestor-or-self::d:index[1]"/>
            </xsl:call-template>
        </fo:block>
    </xsl:template>
    <!-- Anpassung Schriftart für allgemeine Beschriftungen -->
    <xsl:attribute-set name="formal.title.properties" use-attribute-sets="normal.para.spacing">
        <xsl:attribute name="font-weight">bold</xsl:attribute>
        <xsl:attribute name="font-size">9pt</xsl:attribute>
        <xsl:attribute name="hyphenate">false</xsl:attribute>
        <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>         <xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>         <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
    </xsl:attribute-set>
</xsl:stylesheet>
=========

Could someone help me, please?


Thanks in advance!
Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org





--
Ron Catterall
ron@catterall.net


---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org






[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]