XSL-FO is all about the formatting of a document. For the interpretation of spaces and other special characters many options are available. To preserve the whitespaces and new lines in a text at least the property
white-space-collapse should be set to
false (the default setting is true). In my opinion does the name of this property not completely cover its meaning, because it also involves special characters like linefeeds and tabs, but alas it’s close enough. Since the described setting was succesful I did not investigate other properties, like linefeed-treatment and white-space-treatment. Also, the property
white-space should specify a set of properties, but this did not seem to work.
Remarks: Do not always trust the console and the logging messages, because the printed output may differ from the actual content. Our java printXML method converted the carriage return control character into the entity