Re: [xsl] Keeping Text Together

Subject: Re: [xsl] Keeping Text Together
From: siarom egrub <egrubs@xxxxxxxxx>
Date: Mon, 14 Jun 2010 17:46:42 -0700 (PDT)
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">
B B B  <fo:block break-after="auto">
B B B B B  <xsl:choose>
B B B B B B B 
<xsl:when test="parent::productname">
B B B B B B B B B  <fo:block
keep-together.within-column="always">
B B B B B B B B B B B B 
<xsl:apply-templates/>
B B B B B B B B B  </fo:block>
B B B B B B  </xsl:when>
B B B B B B  <xsl:otherwise>
B B B B B B B B B  <xsl:apply-templates/>
B B B B B B  </xsl:otherwise>
B B B B B  </xsl:choose>
B B B  </fo:block>
</xsl:template>

Thanks again,
S. Egrub

B 


----- Original Message ----
From: G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx>
To:
xsl-list@xxxxxxxxxxxxxxxxxxxxxx
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.B  You don't show how you are handling "br" elements.
But, regardless, have you considered using the following:

B  <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 
>b<productname>b 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>B.</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">
>B  B  <fo:inline font-size="16pt">
>B  B  B  B 
<xsl:choose>
>B  B  B  B  B  <xsl:when test="child::br">
>B  B  B  B  B  B  B 
<fo:block keep-with-next="always">
>B  B  B  B  B  B  B  B  B 
<xsl:apply-templates/>
>B  B  B  B  </fo:block>
>B  B  </xsl:when>
>B  B 
<xsl:otherwise>
>B  B  B  B  <xsl:apply-templates/>
>B  B  </xsl:otherwise>
>B  B  B  B  </xsl:choose>
>B  B  </fo:inline>
></xsl:template>
>
>Thanks in
advancw for your help.
>
>Regards,
>S. Egrub


--
XSLT/XQuery training:B 
after http://XMLPrague.cz 2011-03-28/04-01
Vote for your XML training:B 
http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.B  B  B  B  B 
http://www.CraneSoftwrights.com/s/
G. Ken HolmanB  B  B  B  B  B  B  B 
mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07B 
http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:B 
http://www.CraneSoftwrights.com/legal

Current Thread