Page 1 of 1

How to display TocFirstHeader, TocFirstFooter

Posted: Thu Dec 10, 2020 11:47 am
by Kot_1977
I use:
oXygen XML Editor 22.1, build 2020100710
transformation scenario - DITA Map PDF - based on XSL-FO
customization directory - according to oXygen's instructions

I need to display TocFirstHeader, TocFirstFooter (together with TocOddHeader and TocOddFooter) in my pdf.

I've done
in my custom.xsl

Code: Select all

    <xsl:template name="insertTocStaticContents">
        <xsl:call-template name="insertTocOddFooter"/>
        <xsl:if test="$mirror-page-margins">
          <xsl:call-template name="insertTocEvenFooter"/>
        </xsl:if>
        <xsl:call-template name="insertTocOddHeader"/>
        <xsl:if test="$mirror-page-margins">
          <xsl:call-template name="insertTocEvenHeader"/>
        </xsl:if>
[b]        <xsl:call-template name="insertTocFirstHeader"/>
        <xsl:call-template name="insertTocFirstFooter"/>[/b]
    </xsl:template>

    [b]<xsl:template name="insertTocFirstHeader">
        <fo:static-content flow-name="first-toc-header">
            <fo:block xsl:use-attribute-sets="__body__first__header">
                <fo:block text-align="center">
                    TEST_FIRST_TOC_HEADER
                </fo:block>
            </fo:block>
        </fo:static-content>
    </xsl:template>

    <xsl:template name="insertTocFirstFooter">
        <fo:static-content flow-name="first-toc-footer">
            <fo:block xsl:use-attribute-sets="__body__first__header">
                <fo:block text-align="center">
                    TEST_FIRST_TOC_FOOTER
                </fo:block>
            </fo:block>
        </fo:static-content>
    </xsl:template>
[/b]
in my layout-masters.xsl
<fo:simple-page-master master-name="toc-first" xsl:use-attribute-sets="simple-page-master">
<fo:region-body xsl:use-attribute-sets="region-body.odd"/>
<fo:region-before region-name="first-toc-header" xsl:use-attribute-sets="region-before"/>
<fo:region-after region-name="first-toc-footer" xsl:use-attribute-sets="region-after"/>

</fo:simple-page-master>

But it doesn't work: I have standard Toc Odd Header and Footer in my pdf without FirstTocHeader and Footer.
What I did wrong, please explain?

Re: How to display TocFirstHeader, TocFirstFooter

Posted: Thu Dec 10, 2020 2:46 pm
by Radu
Hi,

A couple of years ago we added support to publish DITA content to PDF using CSS to style the output PDF.
Using CSS it's quite easy to customize the headers and footers:

https://www.oxygenxml.com/doc/versions/ ... oters.html

You seem to be using the classic PDF approach of using XSLT to customize the XSL-FO. Officially we no longer provide technical support for this but maybe if you write us an email (support@oxygenxml.com) and attach the entire customization folder I could try to take a look at it.
If you want to debug this further on your side, in the transformation scenario you can set the parameter "clean.temp" to "no". Then after publishing look in the transformation temporary files folder and search for a file named "topic.fo", open this XSL-FO file in Oxygen and try to see if your changes have been integrated in there.
You can also try to ask around on the public DITA Users List, again maybe attach the entire customization folder.

Regards,
Radu

Re: How to display TocFirstHeader, TocFirstFooter

Posted: Mon Dec 28, 2020 8:07 pm
by Kot_1977
Hi!
Thank you for the advice.
the following additional changes in layout-masters.xsl helped me to solve my problem^

Code: Select all

<xsl:template name="generate-page-sequence-master">
....
        <xsl:if test="$first">
          <fo:conditional-page-master-reference master-reference="{$master-reference}-first"
                                                odd-or-even="first"
                                                page-position="first"/>