John Dunning wrote:
I'm trying to correctly format <br>-type line breaks in FOP. The default
template is to match <br> to an empty fo:block:
<xsl:template match="br">
<fo:block/>
</xsl:template>
This correctly breaks a line. However, it does nothing for this case:
<p>testing <!-- should break line --><br/>
<br/><!-- should create blank line-->
a blank line.
</p>
Actually it creates a blank line. The new line happens to have zero height
though.
Where the second <br/> should create a blank line in the rendered output;
for that case, a template like:
<xsl:template match="br">
<fo:block> </fo:block>
</xsl:template>
works properly; but it inserts a blank line (instead of just a carriage
return).
Actually what's wrong with this? You can try a zero width space instead of
a non-breaking space (​). Technically speacking, and for the majority
of layout orientend output formats, the block forces a line break, rather
then inserting a line feed. The latter is a character, the former is a
layout action.
In any case, both <br/> and using a block in FO to force a line break is
considered bad style, from the viewpoint of pure typography.
<rant>
They should never have allowed mixing block FOs with text and inline FOs.
</rant>
J.Pietschmann
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list