Re: [xsl] Keeping Text Together

Subject: Re: [xsl] Keeping Text Together
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Jun 2010 21:16:14 -0400
At 2010-06-14 17:46 -0700, siarom egrub wrote:
Thanks for taking the time to response to my post. Yes, I have tried using <block keep-together.within-column="always"> and the result is the same as detailed below.

Probably because of how you are handling your <br> element with the explicit break:

Here is how the "<br>" element is handled:

<!--=======+Line break (br) template+=======-->
<xsl:template match="br">
    <fo:block break-after="auto">
        <xsl:when test="parent::productname">
          <fo:block keep-together.within-column="always">

The XSL-FO specification states that an explicit break will break an explicit keep.

Your code also reveals a misunderstanding regarding XSLT ... since you imply in an earlier post that <br/> is always empty, using <xsl:apply-templates/> does nothing because you implicitly are pushing child nodes to your stylesheet and <br/> has no child nodes.

You may find the following will work for you:

 <xsl:template match="br">

The simple block will break the line, but it isn't an explicit break so it won't break the keep.

I hope this helps.

. . . . . . . . . . . . Ken

XSLT/XQuery training:   after 2011-03-28/04-01
Vote for your XML training:
Crane Softwrights Ltd.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07
Legal business disclaimers:

Current Thread