Re: PDF header customization; adding product version

Dave C

This is a great example, thanks for posting the info!

Dave C.

--- In, "Chris Johnson" <chris.johnson@...> wrote:

Hey Shawn,

To change the headers for FO processing, I had to modify two files files
in my customization directory:

1. demo/fo/Customization/fo/xsl/custom.xsl

2. demo/fo/Customization/fo/common/vars/en_US.xsl

In my custom.xsl (1.), I need to add two templates: one template to set
a variable for the product version, and another template to override the
header I want to customize.

<!-- set product version -->
<!-- See also demo/fo/cfg/common/vars/en_US.xml --> <xsl:variable
<xsl:variable name="mapProdVersion"
select="/*/*[namespace-uri()='' and
<xsl:variable name="bkinfoProdVersion" select="/*/*[contains(@class, '
bkinfo/bkinfo ')]/prodinfo/vrmlist/vrm/@version"/>
<xsl:when test="$mapProdVersion">
<xsl:value-of select="$mapProdVersion"/>
<xsl:when test="$bkinfoProdVersion">
<xsl:value-of select="$bkinfoProdVersion"/>
<xsl:message>Could not set product version</xsl:message>

Now that I have the variable, I can override the header template, adding
a new parameter "prodversion" to the insertVariable call:

<!-- Body headers and footers (see demo/fo/xsl/fo/static-content.xsl)
--> <xsl:template name="insertBodyOddHeader"> <fo:static-content
<fo:block xsl:use-attribute-sets="__body__odd__header">
<xsl:call-template name="insertVariable">
<xsl:with-param name="theVariableID" select="'Body odd header'"/>
<xsl:with-param name="theParameters">
<xsl:value-of select="$productName"/>
<xsl:value-of select="$productVersion"/>
<fo:retrieve-marker retrieve-class-name="current-header"/>

Now I have called the insertVariable template, with the new
"prodversion" parameter, I need to modify the en_US.xsl file (2.) to use
the prodversion parameter:

<!-- The header that appears on odd-numbered pages. --> <variable
id="Body odd header"><param ref-name="prodname"/>&#xA0;<param
ref-name="heading"/>&#xA0;|&#xA0;<param ref-name="pagenum"/></variable>

This seems to work for me - YMMV.



Chris Johnson
Consultant Developer
XMetaL, a JustSystems company


1c. Re: "Open Topic" in PDF header? Where is this coming from?
Posted by: "Shawn McKenzie" smckenzie23@... smckenzie23
Date: Wed Nov 15, 2006 2:03 pm ((PST))

I'm having problems with this as well. I updated the en_US.xml file and
that works. The problem is that I am working on multiple projects with
the toolkit, so I would like it to pull this information from the
ditamap. So, I added the following to my ditamap:

<vrm version="1.0"/>

I don't really want the vrm element, but it seems it needs to be there
to be valid. Unfortunately, that causes errors with the FO generation.
When I have a topicmeta as above, I get the following:

[java] ERROR: Element 'fo:block-container' cannot be a child of
[java] ERROR: Attribute 'bottom' cannot occur at element
[java] ERROR: Attribute 'left' cannot occur at element
[java] ERROR: Attribute 'position' cannot occur at element
[java] ERROR: Attribute 'right' cannot occur at element
[java] ERROR: Attribute 'top' cannot occur at element
[java] Rendering failed: Invalid XSL FO source
6 errors found during validation
[java] Java Result: 1

Join to automatically receive all group messages.