docbook-apps

Re: Titlepage learning curve

  • 1.  Re: Titlepage learning curve

    Posted 06-23-2021 15:14
    My intention was to add a half-titlepage. I've succeeded in that. I wanted to use a mediaobject in place of the title on both the half-title and titlepage. Iv'e sort of succeeded there, but I don't find it satisfactory.

    In my xml, I have:
    <book>
    <bookinfo>
    <mediaobject .../>

    ...
    </bookinfo>
    </chapter>

    My titlepage xsl has:

    <xsl:template name="book.titlepage.recto">
    <xsl:choose>
    <xsl:when test="bookinfo/mediaobject">
    <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/mediaobject"/>
    </xsl:when>
    <xsl:when test="info/mediaobject">
    <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/mediaobject"/>
    </xsl:when>
    <xsl:when test="bookinfo/title">
    <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/title"/>
    </xsl:when>
    ...
    </xsl:template>

    This substitutes the mediaobject for the title if it is present in the xml source. Exactly as desired.

    I generate similar xsl for cover:
    <xsl:template name="front.cover">
    <xsl:call-template name="page.sequence">
    <xsl:with-param name="master-reference">titlepage</xsl:with-param>
    <xsl:with-param name="content">
    <xsl:choose>
    <xsl:when test="bookinfo/mediaobject">
    <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/mediaobject"/>
    </xsl:when>
    <xsl:when test="info/title">
    <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/title"/>
    </xsl:when>
    <xsl:when test="title">
    <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="title"/>
    </xsl:when>
    </xsl:choose>
    <xsl:choose>
    ...
    </xsl:template>

    But in the fo, this results in two <fo;block.../> calls with the same id, one for the cover, and the other for the titlepage. This generates an error for both fop and ahf. As a workaround, I can put both <info.../> and <bookinfo.../> into <book...\>. Including two separate mediaobjects. This works. I get the desired mediaobjects on both the cover and titlepage. BUT only at the expense of mixing DB 4.5 and DB 5 elements, i.e., info and bookinfo in the same document. This seems like a no-no, right?

    What am I missing?

    ________________________________
    From: Kevin Dunn <kdunn@hsc.edu>
    Sent: Tuesday, June 22, 2021 4:57 PM
    To: docbook-apps@lists.oasis-open.org <docbook-apps@lists.oasis-open.org>
    Subject: [docbook-apps] Re: Titlepage learning curve

    I found this for adding a half title. I worked like a charm:

    https://lists.oasis-open.org/archives/docbook/201212/msg00002.html
    ________________________________
    From: Kevin Dunn
    Sent: Friday, June 18, 2021 5:00 PM
    To: docbook-apps@lists.oasis-open.org <docbook-apps@lists.oasis-open.org>
    Subject: Titlepage learning curve

    I am working my way through
    http://doccookbook.sourceforge.net/html/en/dbc.fo.style-titlepages.html and
    http://www.sagehill.net/docbookxsl/HTMLTitlePage.html

    I think I understand the broad outline, but there are a couple of things that I may not understand yet.


    1. As I understand it, the bit at the top of the first page of a chapter is considered a titlepage, and the template files allow you to customize it. But I don't see any reference to the chapter label, either in the .xml or .xsl template files. For example, by default, my chapters begin:

    Chapter 5. A Very Important Chapter
    but I would like the option of:

    Chapter 5 (centered, smallish font size)
    A Very Important Chapter (next line, centered, largish font size)

    I don't see any way in the templates to refer to the chapter label.


    1. I would also like to control the punctuation at the end of the label, e.g., Chapter 5 (not Chapter 5.), Section 5.2 (not Section 5.2.). I had customized my dsl-jadetex stylesheets to do this, but I can't follow what I did then (years ago) much less translate it into xsl-fo.

    1. What is the best way to substitute a graphic for a titlepage element, e.g. the title or corporate logo as separate pdfs or svgs. I'm imagining including a <fo:external-graphic, but I don't see any examples I can mimic.

    1. Finally, I am old fashioned and I like a half-title. The DocCookbook makes reference to this, but doesn't spell it out.

    Thanks.