tags:

views:

342

answers:

3

Hi,
having a quite simple template:

<xsl:template match="p">
 <fo:block>
  <xsl:apply-templates/>
 </fo:block>
</xsl:template>

I ask myself how to tell FO to keep empty lines if the block is empty.

Cheers
Jan

+2  A: 

Just add a <fo:leader/> element at the end of your <fo:block>. Like this:

<xsl:template match="p">
        <fo:block>
                <xsl:apply-templates/>
                <fo:leader />
        </fo:block>
</xsl:template>

The leader will do nothing for lines with content, and will create an empty line for lines without content.

Tested with Apache FOP and XEP.

chiborg
A: 

Alternatively,

<fo:block white-space-treatment="preserve"> </fo:block>
plutext
+1  A: 

Or

<xsl:template match="p">
    <fo:block>
            <xsl:apply-templates/>
            &#x00A0;
    </fo:block>

&#x00A0; is the equivalent of &nbsp; in HTML (actually &nbsp; is a XML entity that is defined as A0 which is the Unicode character for Non Breaking Space).

XMLDUDE