Why my scenario can't be customized? - index column, header

Here should go questions about transforming XML with XSLT and FOP.
Tz>
Posts: 9
Joined: Tue Mar 23, 2010 7:39 pm

Why my scenario can't be customized? - index column, header

Post by Tz> »

Hi,
I'm using oXygen Author to translate English DocBook 4 XML files into Japanese and transform them to PDF files (so I am not designing documents). My PDFs have no header, one index column, and all bookmarks are expanded. These issues are also in English PDFs. Since the English files are final, I am trying to fix them only in my PDFs. My "Configure parameters" dialog shows values set for the header (header.column.width=1 1 1), index column (column.count.index=2), and bookmarks (bookmark.collapse=1) and I guess they are correct. How can I apply these values to my PDFs? I tried with different values for these parameters but nothing worked (my PDF always has no header, one index column, etc.). When I used a built-in scenario, Docbook PDF, I could apply different values for these parameters. Should I have my English editors fix their XSL files first?
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: Why my scenario can't be customized? - index column, header

Post by Radu »

Hi,

From what I understand creating PDF's using the Oxygen bultin PDF scenarios (which use the standard Docbook XSLs) you can set these parameters and they are taken into account.
So you are probably using a Docbook customization XSLT which does not correctly use these XSLT parameters which are sent by Oxygen. Probably modifications to the custom XSLT's have to be made for this.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Tz>
Posts: 9
Joined: Tue Mar 23, 2010 7:39 pm

Re: Why my scenario can't be customized? - index column, header

Post by Tz> »

Radu wrote:So you are probably using a Docbook customization XSLT which does not correctly use these XSLT parameters which are sent by Oxygen. Probably modifications to the custom XSLT's have to be made for this.
Thank you for helping me. Is the custom XSLT one of the files which have .xsl? Or you are talking about a custom XMLT processor? Is it what I can modify from oXygen Author? Hmm, there are so many XSL/XML files involved...
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: Why my scenario can't be customized? - index column, header

Post by Radu »

Hi,

Yes, XSLT stylesheets are used in the PDF generation.
The Oxygen XML Author cannot be used to properly edit XSLT stylesheets (you can open them as XML files but the editing experience is not very good).

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Tz>
Posts: 9
Joined: Tue Mar 23, 2010 7:39 pm

Re: Why my scenario can't be customized? - index column, header

Post by Tz> »

I added <xsl:param name="bookmarks.collapse" select="1"></xsl:param> to the Japanese XSL, called ja_jp_fo.xsl, which override the our default (English) styles. But my PDF has all bookmarks expanded as default. Other overrides in this XSL work as expected.
This parameter is not supported yet? I am using Apatch FO.
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: Why my scenario can't be customized? - index column, header

Post by Radu »

Hi,

In the Docbook param.xsl stylesheet which can be found in OXYGEN_INSTALL_DIR\frameworks\docbook\xsl\fo\param.xsl the parameter is defined as:

Code: Select all

<xsl:param name="bookmarks.collapse" select="1"/>
above the line there is a message stating:
This parameter currently works with FOP 0.93 or later.

So its default value is to collapse the bookmarks to show only the sections on the first level.
I tested and it works when transforming a simple Docbook sample to PDF using the Apache FOP (which is FOP 1.0 for Oxygen 12).

Maybe from the transformation scenario in Oxygen you have set a custom value to the parameter which overwrites the values in the stylesheets.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Tz>
Posts: 9
Joined: Tue Mar 23, 2010 7:39 pm

Re: Why my scenario can't be customized? - index column, header

Post by Tz> »

I am using XML Author 11.2. I also noticed this was set in the param.xsl but didn't work both for our English PDFs (original) and JA (translation).
So, I added it to my scenario ("bookmarks.collapse" set to 1). Our XSL files for English don't have any override for this parameter. Weird...
Tz>
Posts: 9
Joined: Tue Mar 23, 2010 7:39 pm

Re: Why my scenario can't be customized? - index column, header

Post by Tz> »

I meant oXygen Author, not XML Author..
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: Why my scenario can't be customized? - index column, header

Post by Radu »

Hi,

What version of Apache FOP are you using, the one which is bundled with Oxygen?

To make things more clear here are 2 images showing how the TOC should look like when the "bookmarks.collapse parameter is set to value 1 (the default behavior).
Image

And when the "bookmarks.collapse parameter is set to value 0
Image

Does it not work like this in your case?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Tz>
Posts: 9
Joined: Tue Mar 23, 2010 7:39 pm

Re: Why my scenario can't be customized? - index column, header

Post by Tz> »

Yes, what I want to get is the 1st one and what I have is the second. I guess I am using the version of Apache FOP came with oxygen. Could it be transformer? I use "Xsltproc", I don't know what this does though.
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: Why my scenario can't be customized? - index column, header

Post by Radu »

Hi,

XSLTProc is an XSLT transformer and it should work from what I've tested.

My recommendation to you:
We need to see the intermediary FO file which is generated and which is then processed by Apache FOP.
To do this:
1) Duplicate the current scenario and edit it.
2) In the FO Processor tab uncheck the Perform FO Processing checkbox.
3) In the Output tab set the Save As value to ${cfd}\${cfn}.fo, uncheck the Open in Browser and check the Open in editor
4) Run the transformation on the new scenario, at the end it will open the new FO file in Oxygen.
5) Search in the FO file for attributes starting-state="hide". Are they present on the bookmark elements? These attributes control the expansion state of the bookmark.

If the attributes are present, then probably you are using an older Apache FOP. The FOP version in Oxygen can be found in the Help->About dialog in the Components tab.

If the attributes are not present, then it is a problem in the stylesheets and you can use the debugger to see the value for the bookmarks.collapse parameter.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Tz>
Posts: 9
Joined: Tue Mar 23, 2010 7:39 pm

Re: Why my scenario can't be customized? - index column, header

Post by Tz> »

Thank you for your time. My FO file did not have the attribute. And the About screen shows Apache FOP version 0.95. oXygen Author has the debugger? Selecting "Show debug information" does this? It didn't work for me.
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: Why my scenario can't be customized? - index column, header

Post by Radu »

Hi,

If the attribute is not there, then the parameter in the stylesheets does not have the right value.

The XML Author does not have an XSLT debugger. But you can ask for a trial license for Oxygen XML on our site and use it to debug your problem.
It's hard for me to give you more details because I do not know the level of Docbook customizations that you have. I'm assuming you are using the Docbook XSL's which are bundled with Oxygen.

Something else than you can do is to open the OXYGEN_INSTALL_DIR\frameworks\docbook\xsl\fo\fop1.xsl file in Oxygen Author (as an XML file as XSLT is not supported in the Author), in it there is an xsl:attribute defined:

Code: Select all

<xsl:attribute name="starting-state">
.
You have to place an xsl:message and find out the value of the variable $bookmarks.state. It's value should be hide if the parameter is correctly transmitted.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Tz>
Posts: 9
Joined: Tue Mar 23, 2010 7:39 pm

Re: Why my scenario can't be customized? - index column, header

Post by Tz> »

I am using our XSLs, not those installed with Oxygen. I guess the parameter is disabled somewhere but I cannot find out where...
Currently, my XSL specified in the scenario has the parameter:
<xsl:param name="bookmarks.collapse" select="1"></xsl:param>

And if I use ${frameworks}/docbook/xsl/fo/docbook_custom.xsl instead, then the resultant PDF has collapsed bookmarks as expected.

Our fop1.xsl doesn't have <xsl:attribute name="starting-state">. Here is the contents of our fop1.xsl:

Code: Select all

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version='1.0'>

<xsl:template match="*" mode="fop1.outline">
<xsl:apply-templates select="*" mode="fop1.outline"/>
</xsl:template>

<xsl:template match="set|book|part|reference|
preface|chapter|appendix|article
|glossary|bibliography|index|setindex
|refentry
|sect1|sect2|sect3|sect4|sect5|section"
mode="fop1.outline">

<xsl:variable name="id">
<xsl:call-template name="object.id"/>
</xsl:variable>
<xsl:variable name="bookmark-label">
<xsl:apply-templates select="." mode="object.title.markup"/>
</xsl:variable>

<!-- Put the root element bookmark at the same level as its children -->
<!-- If the object is a set or book, generate a bookmark for the toc -->

<xsl:choose>
<xsl:when test="parent::*">
<fo:bookmark internal-destination="{$id}">
<fo:bookmark-title>
<xsl:value-of select="normalize-space(translate($bookmark-label, $a-dia, $a-asc))"/>
</fo:bookmark-title>
<xsl:apply-templates select="*" mode="fop1.outline"/>
</fo:bookmark>
</xsl:when>
<xsl:otherwise>
<fo:bookmark internal-destination="{$id}">
<fo:bookmark-title>
<xsl:value-of select="normalize-space(translate($bookmark-label, $a-dia, $a-asc))"/>
</fo:bookmark-title>
</fo:bookmark>

<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>

<xsl:if test="contains($toc.params, 'toc')
and (book|part|reference|preface|chapter|appendix|article
|glossary|bibliography|index|setindex
|refentry
|sect1|sect2|sect3|sect4|sect5|section)">
<fo:bookmark internal-destination="toc...{$id}">
<fo:bookmark-title>
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'TableofContents'"/>
</xsl:call-template>
</fo:bookmark-title>
</fo:bookmark>
</xsl:if>
<xsl:apply-templates select="*" mode="fop1.outline"/>
</xsl:otherwise>
</xsl:choose>
<!--
<fo:bookmark internal-destination="{$id}"/>
-->
</xsl:template>

</xsl:stylesheet>
Can you see anything wrong?
Radu
Posts: 9445
Joined: Fri Jul 09, 2004 5:18 pm

Re: Why my scenario can't be customized? - index column, header

Post by Radu »

Hi,

Well, from what it seems you are using the Docbook XSL 1.75.1 or older version and Oxygen comes bundled with Docbook XSL 1.75.2 (which also contains the extra parameter bookmarks.state.

So if you want to control the bookmarks state your developers will have to update the Docbook XSLs to version 1.75.2.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Tz>
Posts: 9
Joined: Tue Mar 23, 2010 7:39 pm

Re: Why my scenario can't be customized? - index column, header

Post by Tz> »

Thanks a lot! Good to know what was the cause. :D
Post Reply