Re: [xsl] <br>-type template match for FOP

Subject: Re: [xsl] <br>-type template match for FOP
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Fri, 12 Dec 2003 19:29:45 +0100
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>&#160;</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 (&#x200B;). 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



Current Thread