1

Is it possible to prevent line breaks inside hyphenated words (XML content) with the Antenna House Formatter? I thought of a solution with a RegEx but don´t know if this is even possible with the AHF.

E.g. the author provides the following: <paragraph>the film we are producing is a very low-budget one</paragraph>

In this case I want to keep the word "low-budget" together in line (like it does here on stackoverflow). But AHF displays it as low- (1st line) and budget (2nd line).

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
garlicDoge
  • 197
  • 1
  • 3
  • 18

1 Answers1

3

There's multiple alternatives:

  • Use hyphenate="false" to turn off hyphenation (https://www.w3.org/TR/xsl11/#hyphenate). Since false is its initial value, your question implies that you have hyphenation turned on and do want to hyphenate other words.

  • If you do have hyphenate="true" to enable hyphenation, you can either replace the - in the existing hyphenated words with &#x2011; (U+2011, NON-BREAKING HYPHEN) or wrap each hyphenated word with an fo:wrapper or fo:inline that has hyphenate="false".

    If you want to replace all hyphens in the output with &#x2011;, you can use a character map in your XSLT (https://www.w3.org/TR/xslt20/#character-maps), otherwise you could selectively replace the character using replace(), as you suggest.

    If you use &#x2011; and don't want your hyphenated words hyphenating at other points, you probably also want to stop that by using axf:hyphenate-hyphenated-word="false" (https://www.antennahouse.com/product/ahf63/ahf-ext.html#axf.hyphenate-hyphenated-word).

Tony Graham
  • 7,306
  • 13
  • 20