xsl-list
[Top] [All Lists]

Re: [xsl] Keeping Text Together

2010-06-14 19:47:07
Hi Ken,

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.

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>

Thanks again,
S. Egrub

 


----- Original Message ----
From: G. Ken Holman <gkholman(_at_)CraneSoftwrights(_dot_)com>
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Sent: Mon, June 14, 2010 3:03:15 PM
Subject: Re: [xsl] Keeping Text Together

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(_at_)CraneSoftwrights(_dot_)com
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


      

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>