Re: [xsl] Elegant way to create an empty line

Subject: Re: [xsl] Elegant way to create an empty line
From: Jan Hoeft <mail@xxxxxxxxxxx>
Date: Sun, 05 Jul 2009 15:04:51 +0200
Hi Ken,
thanks for your ideas.

>><xsl:template match="p">
>>   <fo:block>
>>      <xsl:apply-templates/>
>>   </fo:block>
>></xsl:template>
>>
>>How do I tell FO to create a new line for each <p/>?

To use space-before or space-after I would have to count the following
empty paragraphs in my document.


So if my document looks like:

<p>some text</p>
<p/>
<p/>
<p>more text</p>


The result should look like this:

+-----------+
|some text  |
|           |
|           |
|more text  |
+-----------+


My template generates:

<fo:block>some text</fo:block>
<fo:block/>
<fo:block/>
<fo:block>some text</fo:block>


Since emty blocks collapse, this gives me:

+-----------+
|some text  |
|more text  |
+-----------+


I am searching a solution that does not have to know the content of the
paragraphs or the number of empty paragraphs.
Using leaders or space-after I always have to decide whether the content is
empty or not.

Do you have an idea?
Jan

Current Thread