[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Keeping Text Together

Subject: Re: Keeping Text Together
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Jun 2010 21:16:14 -0400
Re:  Keeping Text Together
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:choose>
        <xsl:when test="parent::productname">
          <fo:block keep-together.within-column="always">
             <xsl:apply-templates/>
          </fo:block>
       </xsl:when>
       <xsl:otherwise>
          <xsl:apply-templates/>
       </xsl:otherwise>
      </xsl:choose>
    </fo:block>
</xsl:template>

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">
   <fo:block/>
 </xsl:template>

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 http://XMLPrague.cz 2011-03-28/04-01
Vote for your XML training:   http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.