Front matter header and footer

Post here questions and problems related to editing and publishing DITA content.
beltrancd
Posts: 2
Joined: Wed Sep 12, 2012 6:04 pm

Front matter header and footer

Post by beltrancd »

Hi,
I have been using oXygen Editor for about a week and using the DITA OT to get PDF output. I have been making several customizations to the PDF output and using this forum and the dita-users group as main source of valuable information (thanks for that!!)

I'm struggling to set up header and footer for the front matter (cover page) though, so I need some help.

I followed exactly the same procedures that worked for all other headers and footers but now using the templates called by the template "insertFrontMatterStaticContents". All I do using these templates have NO impact.

Weird enough if I try to search the web using the keywords
insertFrontMatterOddFooter, insertFrontMatterEvenFooter,
insertFrontMatterOddHeader or insertFrontMatterEvenHeader… I get basically nothing.

Do these templates work at all?

Thanks,
Beltran
beltrancd
Posts: 2
Joined: Wed Sep 12, 2012 6:04 pm

Re: Front matter header and footer

Post by beltrancd »

OK, I figured it out !

I have to say that the source of the problem was my lack of understanding about the real definition of the header and footer templates (odd, even, first, last).

This whole time I was playing around with the even and odd templates of the FrontMatter but for the cover page (which is basically the first page of the FrontMatter) what I really needed was to work on the template of the first page of the FrontMatter… but, you guessed right, there is NO template for the first page of the FrontMatter (I guess is not that common to have header and footer in the cover page).

After I had this realization, it was just a matter of creating/modifying the right templates and also modifying the master layout for the first page of the FrontMatter which only had definition for the "region-body" so I had to add for "region-before" and "region-after".

See below all the details of the modifications (BTW, for all my customizations I've created a custom plugin as described in the manual)
http://dita-ot.sourceforge.net/1.6/read ... ation.html


NOTE: All modifications below were added to the custom.xsl file located at \plugins\your-plugin-name\cfg\fo\xsl\custom.xsl


1.- Modify the template insertFrontMatterStaticContents originally found at \DITA-OT1.6.2\plugins\org.dita.pdf2\xsl\fo\static-content.xsl including two new calls for two new templates insertFrontMatterFirstHeader and insertFrontMatterFirstFooter (in bold below)

<xsl:template name="insertFrontMatterStaticContents">
<xsl:call-template name="insertFrontMatterFootnoteSeparator"/>
<xsl:call-template name="insertFrontMatterOddFooter"/>
<xsl:if test="$mirror-page-margins">
<xsl:call-template name="insertFrontMatterEvenFooter"/>
</xsl:if>
<xsl:call-template name="insertFrontMatterOddHeader"/>
<xsl:if test="$mirror-page-margins">
<xsl:call-template name="insertFrontMatterEvenHeader"/>
</xsl:if>
<xsl:call-template name="insertFrontMatterFirstHeader"/>
<xsl:call-template name="insertFrontMatterFirstFooter"/>

<!-- <xsl:call-template name="insertPrefaceLastHeader"/>-->
<!-- <xsl:call-template name="insertPrefaceLastFooter"/>-->
</xsl:template>


2.- Create the two brand new templates referred above: insertFrontMatterFirstHeader and insertFrontMatterFirstFooter (see in bold the content of the header and footer, just place holders).

<xsl:template name="insertFrontMatterFirstHeader">
<fo:static-content flow-name="first-frontmatter-header">
<fo:block xsl:use-attribute-sets="__body__first__header">
<fo:block text-align="center">
<fo:external-graphic src="url({concat($artworkPrefix,'/Customization/OpenTopic/common/artwork/nominum_logo.gif')})"/>
</fo:block>

</fo:block>
</fo:static-content>
</xsl:template>

<xsl:template name="insertFrontMatterFirstFooter">
<fo:static-content flow-name="first-frontmatter-footer">
<fo:block xsl:use-attribute-sets="__body__first__footer">
<fo:block text-align="center">
<fo:external-graphic src="url({concat($artworkPrefix,'/Customization/OpenTopic/common/artwork/nominum_logo.gif')})"/>
</fo:block>

</fo:block>
</fo:static-content>
</xsl:template>


3.- Finally, modify the simple-page-master layout for the front-matter-first page adding region before and after definitions (in bold below)

<xsl:template name="createDefaultLayoutMasters">
<fo:layout-master-set>
<!-- Frontmatter simple masters -->
<fo:simple-page-master master-name="front-matter-first" xsl:use-attribute-sets="simple-page-master">
<fo:region-body xsl:use-attribute-sets="region-body__frontmatter.odd"/>
<fo:region-before region-name="first-frontmatter-header" xsl:use-attribute-sets="region-after"/>
<fo:region-after region-name="first-frontmatter-footer" xsl:use-attribute-sets="region-after"/>

</fo:simple-page-master>

…snip, Rest of the template


Best regards,
Beltran
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Front matter header and footer

Post by sorin_ristache »

Hi Beltran,
beltrancd wrote:After I had this realization, it was just a matter of creating/modifying the right templates and also modifying the master layout for the first page of the FrontMatter which only had definition for the "region-body" so I had to add for "region-before" and "region-after".

See below all the details of the modifications (BTW, for all my customizations I've created a custom plugin as described in the manual)
http://dita-ot.sourceforge.net/1.6/read ... ation.html


NOTE: All modifications below were added to the custom.xsl file located at \plugins\your-plugin-name\cfg\fo\xsl\custom.xsl
Yes, customizing the front page requires editing the XSLT stylesheet that creates the FO layout. Thank you for letting us know these details!


Thank you,
Sorin
kmank
Posts: 118
Joined: Mon Apr 19, 2010 5:33 pm

Re: Front matter header and footer

Post by kmank »

I am just getting into the modification of PDF FO for O14. To be clear, just where is the XSLT file for modifying the Cover page of the PDF (not legacy)?

thanks!
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Front matter header and footer

Post by sorin_ristache »

Hello,

For modifying the cover page of the DITA Map PDF output in Oxygen 14.1 you should start from the XSLT template with the attribute name="createFrontMatter" from [Oxygen-install-dir]/frameworks/dita/DITA-OT/plugins/org.dita.pdf2/xsl/fo/front-matter.xsl. You should follow the procedure described here.


Regards,
Sorin
Post Reply