header footer and cover page issues

Here should go questions about transforming XML with XSLT and FOP.
bitcoder
Posts: 3
Joined: Thu Oct 08, 2009 2:07 pm

header footer and cover page issues

Post by bitcoder »

I'm newbie on XSLT FOP and DITA.
I need some help on how to edit the .xsl file in order to:

1. Have the same header on every page (including TOC, except the cover)
with 2 columns if possible and a black line separating it from the rest of the body

2. Same thing with the footer (but with 3 columns).

3. And how can I edit the cover page?
I want to have a logo with 2 lines of text next to it,
the title, then the subtitle, and at the end a few lines of info.
Also one word of header and one at the footer.

I dont expect to tell me everything, but some guide notes.
Im learning at this point, so i would appreciate some help!
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: header footer and cover page issues

Post by Radu »

Hi,

I will assume you would like to customize the DITA Open Toolkit PDF IDIOM transformation (and not the old Legacy transformation).
Some customization for headers and footers can be done in files like OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/demo/fo/cfg/common/vars/en_US.xml.
You can open the file in Oxygen and there are variables like Product Name, Body odd footer, etc which can have some custom text set to them.
This is probably what can be customized for questions [1] and [2] without modifying stylesheets.

As for problem number [3], there is an XSLT stylesheet called OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/demo/fo/xsl/fo/front-matter_1.0.xsl. It contains a template called createFrontMatter_1.0. I think that if you know XSL-FO you can try customize the template's contents to achieve your goals.

Also, you can find here the address of the DITA Users list.
It is also a very good place to ask customization questions.
http://www.oxygenxml.com/forum/post1140 ... ces#p11407

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
bitcoder
Posts: 3
Joined: Thu Oct 08, 2009 2:07 pm

Re: header footer and cover page issues

Post by bitcoder »

Thanks for your fast answer!
Yes, I am talking about DITA-OT PDF Idiom.
Sorry I forgot to mention before.

I started editing the file, and I've tried to find some ways to put hex code for breaking line (line separator) with &#x2028;. But it didn't work.

Is there a way to make this done?

Or, can I have columns?
I found this on an other forum...

Code: Select all

<xsl:variable name="__body__even__footer__Cols">1 10 3</xsl:variable>
<xsl:variable name="__body__even__footer__col_1" select="$xmPageNumber"/>
<xsl:variable name="__body__even__footer__col_2">TESTING TESTING 123 HELLO WORLD</xsl:variable>
<xsl:variable name="__body__even__footer__col_3" select="$xmDocumentTitle"/>
...but if i understand correctly, this is for the stylesheets.
Is there something similar?

Or.. can I put variables of my own, and call them from an other file?
ie:

Code: Select all

<variable id="Header_Center">Manual</variable>
<variable id="Header_Left">XXXXXXX</variable>
and how should i call these variables?

thanks a lot for your help!
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: header footer and cover page issues

Post by Radu »

Hi,

I cannot give you a customization solution for having the product name on separate lines.
In my opinion you will probably have to modify the stylesheets for this.
In the OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/demo/fo/xsl/fo/static-content.xsl for example you can search all occurences of the <product> tag. The tag contains the value of the variable that you set in the customization file. It is then used by calling other templates to generate the FO.
So you will probably need to have a deeper understanding of the stylesheets used and of the FO output by setting some xsl:messages to see through which templates the product name reaches the output.

Asking these questions on the DITA Users list might provide you with some solutions from people who had similar problems.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
bitcoder
Posts: 3
Joined: Thu Oct 08, 2009 2:07 pm

Re: header footer and cover page issues

Post by bitcoder »

Ill try that.
In the meanwhile I was playing with the static-content.xsl, and I think ill figure out a solution.
Ill ask at the site you recommended for further help.

Thanks very much for your help with the vars/en_US.xml file!!
It helped me to find out where to look next.
Leodong
Posts: 7
Joined: Wed Apr 11, 2012 8:54 pm

Re: header footer and cover page issues

Post by Leodong »

Hi I followed this Post and try to modify headers and footers too. I didn't find "en_US" file much helpful, when I replace the variable id, say <!-- The footer that appears on odd-numbered pages. -->
<variable id="my book"/>
it did nothing.....Can somebody offer some generous solutions?

When I make some attempts to static-contents.xsl file, I haven't figured a solution. Which parameters should I modify? The previous post mentioned <product> tag, but say, when I did:
<prodname>
<xsl:value-of select="$MyBook"/>
</prodname>
it reported error, by removing the dollar sign, it changed nothing....

Very confused with the header footer customization. Can somebody give a hand?

appreciate,

LeoDong
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: header footer and cover page issues

Post by Radu »

Hi,

Basically configuration files like:

OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/demo/fo/cfg/common/vars/en.xml

contain some constructs like:

Code: Select all

<variable id="Preface first header"/>
But there are not XSLT variables, the XML files are simple configuration files which are used from the XSLT stylesheets by using code like:

Code: Select all

<xsl:call-template name="insertVariable">
<xsl:with-param name="theVariableID" select="'Preface first header'"/>
<xsl:with-param name="theParameters">
........................
</xsl:call-template>
The utility template insertVariable is defined in this XSLT:

OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/demo/fo/xsl/common/vars.xsl

So what you were trying to do was to define a custom variable in the configuration XML file and then reference it like as XSLT variable instead of using the utility template to expand the custom variable's content.

Usually the best way to make customizations is to have a separate customization directory (outside of the DITA Open Toolkit) and overwrite certain XSLT templates:

http://www.oxygenxml.com/forum/post1864 ... rig#p18642

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply