Apache-fop: hyphenation for identifiers

Here should go questions about transforming XML with XSLT and FOP.
Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Apache-fop: hyphenation for identifiers

Post by Patrik » Wed Dec 04, 2013 11:19 am

Hi,

since one use-case of oxygen is writing specifications in a dita-derived document-type we have lots of identifiers in our texts. For these the standrd hyphenation patterns are not sufficient.
For instance identifieres like THIS_IS_AN_IDENTIFIER or ThisIsAnIdentifier. Suitable hyphenatin points would obvioulsy be right after an underscore or after a lower-case letter followed by an upper-case letter. Is there an easy way to make apache-fop do this? (The hyphen pattern file for German with 14k+ entries is quite scary...)

Furthermore there are some identifiers without any patterns I could think of. Thus, I'd need a way to set the possible hyphenation positions explicitly. In Framemaker this can be done by adding a soft hyphen right in the word and in latex you can define the hyphenation for individual words.
Is there anything similar that is working with oxygen and Apache-fop?

Thanks for any advice,

Patrik

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: Apache-fop: hyphenation for identifiers

Post by sorin_ristache » Wed Dec 04, 2013 12:24 pm

Hi Patrik,

You have to add your own custom hyphenation patterns to the existing standard ones provided by the OFFO project. I think you should add your custom hyphenation patterns to the XML source form of the set of patterns for your language, build the binary format (get a jar file) from the XML source form and after that deploy the result jar file in Oxygen.


Regards,
Sorin

Patrik
Posts: 280
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: Apache-fop: hyphenation for identifiers

Post by Patrik » Mon Jan 13, 2014 1:04 pm

Hi Sorin,

finally I'm back to this topic...

Thanks for your replay, but we found no easy way to formulate suitable hyphenation patterns.

However, we found another solution that works fine for us so far (in case, someone else has this problem):
In the transformation for the fop-generation we add an additional transformation for text-nodes within elements that can contain identifiers (e.g. <codeph>). This transformation adds soft-hyphens at the following positions:
- between '.' and a letter
- between '_' and a letter
- after (at least) two lowercase letters before an uppercase letter

Regards,

Patrik

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: Apache-fop: hyphenation for identifiers

Post by sorin_ristache » Mon Jan 13, 2014 1:19 pm

Hi Patrik,

Thank you for letting us know. Other users may find this soft hyphen trick helpful.


Thank you,
Sorin

lisazeng99
Posts: 14
Joined: Thu Sep 14, 2017 10:24 am

Re: Apache-fop: hyphenation for identifiers

Post by lisazeng99 » Mon Aug 24, 2020 2:35 pm

Hi all,

from the installation in https://xmlgraphics.apache.org/fop/1.0/ ... ml#install
"Download the precompiled JAR from OFFO and place it either in the {fop-dir}/lib directory"

Can you share where is {fop-dir}/lib ? I can only find {oxygen -dir}/lib . should I copy the downloaded jar there?

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

Re: Apache-fop: hyphenation for identifiers

Post by Radu » Mon Aug 24, 2020 2:44 pm

Hi Lisa,

This forum thread was started 16 years ago, maybe you could have started a new post instead :)
If you are interested to make this work for DITA publishing maybe this link will help:
https://www.oxygenxml.com/doc/versions/ ... ransformat

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

Post Reply