Page 1 of 1

Front matter header and footer

Posted: Wed Sep 12, 2012 6:19 pm
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

Re: Front matter header and footer

Posted: Thu Sep 13, 2012 10:36 am
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

Re: Front matter header and footer

Posted: Thu Sep 13, 2012 12:46 pm
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

Re: Front matter header and footer

Posted: Thu Feb 07, 2013 8:51 pm
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!

Re: Front matter header and footer

Posted: Fri Feb 08, 2013 10:22 am
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