xsl-fo and linefeed-treatment

Here should go questions about transforming XML with XSLT and FOP.
willisd1
Posts: 8
Joined: Fri Jan 23, 2009 4:46 pm

xsl-fo and linefeed-treatment

Post by willisd1 »

I have looked through the previous postings and could not quite find the answer to my question so here it is. It seems like a basic xsl-fo operation so I'm sure someone can help.

I am using the Apache FOP processor that was supplied with Oxygen 10.2
In my XML file I have a <Comment> field that contains several paragraphs of information seperated by (U+000A) linefeeds.
My xsl-fo file has the following block statement -

Code: Select all

<fo:block text-align="justify" line-height="1.1" font="12pt Calibri" font-weight="normal" linefeed-treatment="preserve" white-space-collapse="false" wrap-option="wrap" white-space-treatment="preserve" space-after="0.3in">
<xsl:value-of select="//Inspection[position()=1]/Comment"/>
</fo:block>
In the result .pdf the paragraphs have all run together. It is like the linefeed-treatment statement has no effect. What am I missing?

Thanks in advance,
Sean
willisd1
Posts: 8
Joined: Fri Jan 23, 2009 4:46 pm

Re: xsl-fo and linefeed-treatment

Post by willisd1 »

Amazing how that works. I struggle and struggle to solve my own problems and don't find the solution until I post it.

The problem turned out to be in my schema. I had the <Comment> element type set as xs:normalizedString.

Since I am using the Saxon-SA 9.0.1.6 Transformer it was replacing each newline, tab and carriage return with a single space character. Thus the xsl-fo processor was not being presented with the original spacing and linefeeds...whew!
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: xsl-fo and linefeed-treatment

Post by Radu »

Hi Sean,

Thanks for sharing the problem and solution with us.

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