FO hyphenate.verbatim not working

Here should go questions about transforming XML with XSLT and FOP.
jkeys089
Posts: 5
Joined: Mon Sep 24, 2012 6:54 pm

FO hyphenate.verbatim not working

Post by jkeys089 »

When I enable it I get an exception:

Code: Select all

ERROR - Couldn't find hyphenation pattern en
ERROR - Exception
java.lang.IllegalArgumentException: factor < 0; was: -1
at org.apache.fop.cli.InputHandlerFOP.transformTo(Unknown Source)
at org.apache.fop.cli.InputHandlerFOP.renderTo(Unknown Source)
at org.apache.fop.cli.Main.startFOP(Main.java:174)
at org.apache.fop.cli.Main.main(Main.java:205)
So I found another thread which tells me to download some old FOP libs (which I did).
Now there are just hyphens littering my programlisting elements.

I just want programlisting elements to wrap on the page instead of running of the page.

Any help would be very much appreciated.
jkeys089
Posts: 5
Joined: Mon Sep 24, 2012 6:54 pm

Re: FO hyphenate.verbatim not working

Post by jkeys089 »

Here is the best solution I came up with in case anyone else is having this problem:

Please this code in your docbook_custom.xsl

Code: Select all


    <xsl:template match="d:programlisting">
<fo:block language="en"
wrap-option="wrap"
linefeed-treatment="preserve"
font-family="monospace"
white-space-collapse="false"
white-space-treatment="preserve">
<xsl:apply-templates></xsl:apply-templates>
</fo:block>
</xsl:template>
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: FO hyphenate.verbatim not working

Post by sorin_ristache »

Hi,

Thank you for letting us know the workaround that you found. The FO transformation should not end with an IllegalArgumentException. This is a bug in the Apache FOP processor. By forcing a wrap inside the fo:block corresponding to a programlisting element you avoided the bug.


Regards,
Sorin
Post Reply