Breaking lines with a hyphen

Here should go questions about transforming XML with XSLT and FOP.
g3org3
Posts: 5
Joined: Fri Mar 04, 2005 12:10 am

Breaking lines with a hyphen

Post by g3org3 »

I'm trying to output some java souce code in a docbook pdf. I want long lines to be wrapped with a continuation character. The problem is that when I turn on hyphenation to allow this, I get a hyphen in front of almost every word. Is this a problem with the built in fop? Or am I doing something wrong? Here's the xsl in my customisation layer:

Code: Select all


...
<xsl:import href="file:/Applications/oxygen/frameworks/docbook/xsl/fo/docbook.xsl"/>
<xsl:param name="hyphenate.verbatim" select="1"/>
<xsl:attribute-set name="monospace.verbatim.properties"
use-attribute-sets="verbatim.properties monospace.properties">
<xsl:attribute name="font-size">75%</xsl:attribute>
<xsl:attribute name="wrap-option">wrap</xsl:attribute>
<xsl:attribute name="hyphenation-character">&#x25BA;</xsl:attribute>
</xsl:attribute-set>
...
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

It doesn't seem to be a problem in FOP. Do you use a hyphenation file together with FOP ? How did you obtain it ?

Regards,
Sorin
g3org3
Posts: 5
Joined: Fri Mar 04, 2005 12:10 am

Post by g3org3 »

First I should point out that I'm new to this and I've just been gathering information about docbook and fo from the web as I go, so it's quite possible I've misunderstood somewhere along the line. I thought getting a hyphenation file might fix the problem so I got en.xml via this page http://xml.apache.org/fop/hyphenation.html. I downloaded an example fop configuration file and set the hyphenation directory where I put en.xml, then I set oxygen's fo preferences to the location of the config file. It didn't make any difference! Is that what I should have done? Thanks for your help.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

The English hyphenation file is part of the FOP's standard hyphenation support so you don't have to download and set any config file for that. Using the <oXygen/> built in FOP is enough. I tested that and it works with non verbatim DocBook elements like para (verbatim elements are programlisting, screen, synopsis).

For verbatim elements I got the same wrong result: a hyphen in front of almost every word. This happened for me both with the FOP's builtin hyphenation support for the English language and with a config file specifying the directory with the en.xml file downloaded from the Apache site. What you did in your customisation layer is right but the problem is in the DocBook XSL stylesheet imported by your layer. You can see that if you disable the FO processing in the transformation scenario edit dialog (the FO Processor tab), change the value of Save As (the Output tab) to FOPinput.fo for example and look at the generated .fo file. So FOP does not add the strange hyphens to your document content but they are already present in the FOP input file. The next step is to ask about the strange hyphens on the docbook-apps list:

http://www.oasis-open.org/docbook/mailinglist/

The list archives are at:

http://lists.oasis-open.org/archives/docbook-apps/

I hope this helps,
Sorin
g3org3
Posts: 5
Joined: Fri Mar 04, 2005 12:10 am

Post by g3org3 »

Many thanks for your help. It's good to know I wasn't totally off track! I'll post back here if/when I find a solution.
dleal
Posts: 41
Joined: Fri Dec 15, 2006 8:09 pm
Location: Madrid
Contact:

Post by dleal »

Dear g3org3 and sorin,

I have the same problem. Did you arrived to any solution about this problem?

Thanks in advance,

David
Post Reply