Search code examples
xmlpdfxsl-folinefeed

How can I apply linefeed in XSL-FO?


After some tries I could not figure it yet, how / where should be write in a XML file:

<xsl:if test="//txtA/text() != '' ">
     <fo:block xsl:use-attribute-sets="dossier.p">
         <xsl:value-of select="//txtA/text()" linefeed-treatment="preserve"/>
     </fo:block>
</xsl:if>

Solution

  • The attribute linefeed-treatment tells the formatter how to output the text inside. Because you are using xsl:value-of you are merely outputting a string. You need linefeed-treatment on the containing fo:block. Try moving it to the block and not on value-of template.