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

Subject: [xsl] <br>-type template match for FOP
From: "John Dunning" <jdunning@xxxxxxxxx>
Date: Fri, 12 Dec 2003 11:44:29 -0500
Hi all,
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>

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).

What I've been trying to do (with no success) is something like the
following:
<xsl:choose>
    <xsl:when
test="preceding-sibling::node()[1][text()='&#xA;']/preceding-sibling::node()
[1][name()='br']">
        <fo:block>&#160;</fo:block>
    </xsl:when>
    <xsl:otherwise>
        <fo:block/>
    </xsl:otherwise>
</xsl:choose>

Any help would be appreciated.
TIA,
John



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread