Re: [xsl] Keeping Text Together

Subject: Re: [xsl] Keeping Text Together
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Jun 2010 18:03:15 -0400
It seems strange that you would put a block
inside of an inline.  You don't show how you are handling "br" elements.

But, regardless, have you considered using the following:

<block keep-together.within-column="always">

I hope this helps.

. . . . . . . . . . Ken

At 2010-06-13 18:50 -0700, siarom egrub wrote:
Hi All,

I am trying to keep text in an element/tag
together and not separated across two pages when
generated in a PDF using XSL-FO. The text is in
<productname> tag in the XML snippet below has
a line break tag "<br/>" -- the text before and
after the line break tag should keep-together
always; however, it is breaking across two pages. See example below.
How can I get the text to keep-together always?

IT IS DISPLAYING/BREAKING ACROSS TWO PAGES LIKE THIS:

DAT Multiple Low Urine Control
============Page Break=========
DAT Multiple High Urine Control

THE REQUIRED DISPLAY IS AS FOLLOWS:

DAT Multiple Low Urine Control
DAT Multiple High Urine Control

<!--======+XML Snippet+======-->
<productInfo>
<systemname>SYNCHRON<superscript>.</superscript> Systems</systemname>
<productname>DAT Multiple Low Urine
Control<br/>DAT Multiple High Urine Control</productname>
<kitRef><Ref>474979, 474976</Ref></kitRef>
<forUse>For <emphasis role="bolditalics">In
Vitro</emphasis> Diagnostic Use</forUse>
</productInfo>

<!--======+Productname template+======-->
<xsl:template match="productname">
    <fo:inline font-size="16pt">
       <xsl:choose>
          <xsl:when test="child::br">
              <fo:block keep-with-next="always">
                 <xsl:apply-templates/>
       </fo:block>
   </xsl:when>
   <xsl:otherwise>
       <xsl:apply-templates/>
   </xsl:otherwise>
       </xsl:choose>
    </fo:inline>
</xsl:template>

Thanks in advancw for your help.

Regards,
S. Egrub


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