PDF Output: Custom button/ box format. Right side of the frame is missing

Here should go questions about transforming XML with XSLT and FOP.
DKeyes
Posts: 9
Joined: Tue Jan 31, 2012 1:13 pm

PDF Output: Custom button/ box format. Right side of the frame is missing

Post by DKeyes »

Hello,

We are currently trying to make our user manual a bit more flexible
regarding its maintenance. In this process, we replaced buttons that have previously been inserted as screenshots by a new format in Oxygen/ Docbook, basically imitating the original buttons. The new buttons have a light-grey background, use a purple font, have a purple frame and are based on a custom style in our Style sheet.
Oxygen and the HTML transformation display the new "buttons" correctly, but the right side of the frame disappears if we transform the documents to PDF.

The code in the XSL stylesheet for the
PDF transformation looks like this:

<xsl:template match="d:button">
<fo:inline border-style="solid" background-color="#D3D3D3" color="#4B0082" font-family="Courier New" font-weight="bold" text-align="start" >
<xsl:apply-templates/>
</fo:inline>
</xsl:template>

The frame is there, but the right border is missing.
Maybe this is a mistake simply resulting from the missing link between the
various output forms (Editor vs. Html vs. PDF). I already sent a mail to the Docbook app-list, but so far no one seemed to have the same issues as we have using the code stated above.

I already tried eliminating the problem by adding but also removing some of the properties (removing everything except the border-style, adding padding etc.).
Can anybody help us fixing the problem?

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

Re: PDF Output: Custom button/ box format. Right side of the frame is missing

Post by sorin_ristache »

Hello,
DKeyes wrote:The code in the XSL stylesheet for the
PDF transformation looks like this:

<xsl:template match="d:button">
<fo:inline border-style="solid" background-color="#D3D3D3" color="#4B0082" font-family="Courier New" font-weight="bold" text-align="start" >
<xsl:apply-templates/>
</fo:inline>
</xsl:template>

Did you extend the Docbook schema by defining a new element called button for replacing the Docbook guibutton element? Do you mean the inlinemediaobject elements which is allowed inside the guibutton did not help you for displaying in the output exactly the image/icon of the button?

DKeyes wrote:I already tried eliminating the problem by adding but also removing some of the properties (removing everything except the border-style, adding padding etc.).
Can anybody help us fixing the problem?
Did you try to reduce the XML document and look in the corresponding FO file to see what is wrong? Please reduce the source XML document to a small working sample and send us the XML file, your XSLT customization and the FO file which is generated by the XSLT transfromation and which contains that element <fo:inline border-style="solid" background-color="#D3D3D3" ....


Regards,
Sorin
DKeyes
Posts: 9
Joined: Tue Jan 31, 2012 1:13 pm

Re: PDF Output: Custom button/ box format. Right side of the frame is missing

Post by DKeyes »

Hello Sorin,

thanks for the reply. It took me a while to answer.
Until now, we tried several approaches to handle the problem.

After all, we considered that it would be best to reset the entire schema and stylesheet back to "factory settings". Starting from scratch seemed to be a good idea to find the error (we created a backup). All that remained was Oxygens supplied version of Docbook 5.0.

We added our button style to the styelsheet:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xml:lang="de"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:d = "http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="d"
version="1.0">

<xsl:import href="docbook.xsl"/>

<xsl:template match="d:button">
<fo:inline background-color="#D3D3D3" border-style="solid" border-width="thin" >
<xsl:apply-templates/>
</fo:inline>
</xsl:template>

</xsl:stylesheet>



as well as a matching counterpart to the schema docbookxi.rng. This was the only customization we made.
However, the borders were still missing when transforming to PDF

After all, the bottom line is that:
- Except of the border, our custom style is working just fine. There is a link between stylesheet and schema
- Its not Adobe Reader (Zoom etc.)
- Its not our stylesheet or schema

So what´s the problem?
- Is it possible that Oxygen and its FO processor cannot handle our custom style? I
- Members of the DocBook mailing list already managed to successfully transform our style to PDF
- Is is possible that Oxygen supplied an old or at least buggy version of DocBook 5.0?
- How is it possible that our styles works if we use fo:block instead? We have several "boxes" in our manuals and their all rendered correctly.


Thanks for your help.
DKeyes
Posts: 9
Joined: Tue Jan 31, 2012 1:13 pm

Re: PDF Output: Custom button/ box format. Right side of the frame is missing

Post by DKeyes »

I forgot:
We extended our schema by adding a custom element. It works, but the right border is missing.

We double-checked our XSL / FO template. Everything looks fine. As mentioned before, the right border was still missing when we used the default XSL/ FO template.
DKeyes
Posts: 9
Joined: Tue Jan 31, 2012 1:13 pm

Re: PDF Output: Custom button/ box format. Right side of the frame is missing

Post by DKeyes »

This is was Bob Stayton answered me as a reply to me request:

"I did some testing and found that the problem seems to be the FOP that ships with Oxygen 14. Here is what I did.

I copied your customization and configured an Oxygen 14 transformation to apply the customized stylesheet *and* run the built-in FOP processor. For the Transformation Output tab, I said to Prompt for filename so I could keep track of the output. That PDF file duplicated the result you were seeing with the missing right border.

Then I changed the transformation to just produce the FO output. When I examined the FO output file, it looked ok. When I subsequently processed that saved FO file with the FOP 1.0 I had installed separately on my system, the output showed the right border.

Then I changed the Oxygen configuration using Options > Preferences > XML > XSLT-FO-XQuery > FO Processors. Under Apache FOP, I selected "Use other Apache FOP", and browsed to the fop.bat file that I had installed separately on my system. I saved that configuration, and when I ran the transformation, the output showed the right border.

So I concluded that the version of FOP 1.0 that ships with Oxygen 14 seems to be the source of this problem. Oddly, I compared the fop.jar in Oxygen 14 to the fop.jar in my installation, and they are identical. So I cannot explain why this happens. But if you download FOP 1.0, install it, and point Oxygen 14 to use it, then you should get the right border.

And let Oxygen Support know about this (you can forward this information if you like).

Bob Stayton"


It really seems to be Oxygen´s supplied FOP.
DKeyes
Posts: 9
Joined: Tue Jan 31, 2012 1:13 pm

Re: PDF Output: Custom button/ box format. Right side of the frame is missing

Post by DKeyes »

Hi,

we managed to transform our style using a different FOP.

At first, we first tried to run a transformation with fop 1.0. This didn´t work, so we used fop1.1rc1.

fop1.1.rc1 is still a release candidate, but it works just fine for our transformation. Each element / style is at its place and our PDFs finally show the right border of our buttons.

We really don´t what it was, but it looks like the FOP of our Oxygen version (13) couldn´t handle our style.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: PDF Output: Custom button/ box format. Right side of the frame is missing

Post by sorin_ristache »

Hi DKeyes,
DKeyes wrote:So I concluded that the version of FOP 1.0 that ships with Oxygen 14 seems to be the source of this problem. Oddly, I compared the fop.jar in Oxygen 14 to the fop.jar in my installation, and they are identical. So I cannot explain why this happens. But if you download FOP 1.0, install it, and point Oxygen 14 to use it, then you should get the right border.
Thank you for keeping us updated on that discussion. I agree with Bob Stayton that it is strange to get a different result in two FO transformations that use two fop.jar files which in fact are identical (at least in file size, and I suppose in content too).
DKeyes wrote:fop1.1.rc1 is still a release candidate, but it works just fine for our transformation. Each element / style is at its place and our PDFs finally show the right border of our buttons.

We really don´t what it was, but it looks like the FOP of our Oxygen version (13) couldn´t handle our style.
We will update the Apache FOP library in Oxygen when it reaches stable status.


Thank you for letting us know,
Sorin
Post Reply