Setting header and footers for DITA PDF

Post here questions and problems related to editing and publishing DITA content.
rww
Posts: 23
Joined: Wed Jul 24, 2013 12:40 am

Setting header and footers for DITA PDF

Post by rww »

I'm working in the my XML customization directory trying to change the headers, footers and various other elements in my DITA PDF output.

I've added the "template name="insertBodyEvenHeader">" to customized custom.xsl file, and am attempting to change the <my_customization>/common/var/en.xml file to set my product values. For example, I'm trying to change the product name variable <variable id="Product Name"/>. But no matter how I try to change it (for example <variable id="Widget 3000"/>, or <variable id="Product Name, 'Widget 3000'"/>, or <variable id="Product Name="Widget 3000""/> ...etc), nothing seems to work.

I've also tried setting values within the insertBodyEvenHeader template, but my guess is this isn't a good place to set values as they'd have to be changed for each language.

Where am I going wrong, apart from having little experience with XML and XSL.

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

Re: Setting header and footers for DITA PDF

Post by sorin_ristache »

Hi,

You just have to follow the instructions for customizing the PDF transformation from the file [Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\org.dita.pdf2\README.txt. If you add your modifications in the default directory for such customizations, which is [Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\org.dita.pdf2\Customization, then you should do the following:
  • Duplicate the file org.dita.pdf2\Customization\fo\xsl\custom.xsl.orig and rename it to custom.xsl.
  • Add the following templates to this file (copied from org.dita.pdf2\xsl\fo\static-content.xsl) and customize them in any way you want:

    Code: Select all

    <xsl:template name="insertBodyOddHeader">

    <xsl:template name="insertBodyEvenHeader">

    <xsl:template name="insertBodyOddFooter">

    <xsl:template name="insertBodyEvenFooter">
  • Duplicate the file org.dita.pdf2\Customization\fo\attrs\custom.xsl.orig and rename it to custom.xsl.
  • Add the following element in this stylesheet which will enable the even headers and footers (by default only the odd headers and footers are enabled, this is why you did not see your even header customization in the PDF output):

    Code: Select all

    <xsl:variable name="mirror-page-margins" select="true()"/>
  • Uncomment the following two declarations in the catalog file org.dita.pdf2\Customization\catalog.xml:

    Code: Select all

      <uri name="cfg:fo/attrs/custom.xsl" uri="fo/attrs/custom.xsl"/>

    <uri name="cfg:fo/xsl/custom.xsl" uri="fo/xsl/custom.xsl"/>
  • Edit the DITA PDF transformation and set the path of the directory org.dita.pdf2\Customization in the parameter called customization.dir.
  • Run the DITA PDF transformation again to add the custom headers and footers in the PDF output.

Regards,
Sorin
Post Reply