Pascal Sancho <pascal.sancho <at> takoma.fr> writes: > > Hi, > > XSLT snippet is not appropriate to figure what you describe. > You should a *short* XSL-FO to this thread, that demonstrates the issue > you are describing. > > Le 17/02/2012 01:19, Lal Mohanty a écrit : > > I am having a problem with keep-together.within-page="always" in Fop 0.95/1.0. > > It behaves erratically depending on size of the content. I need to print a > > letter where all contents (Request/Data/Body/Para and Request/Data/Closure) > > need to be printed in one page. If it does not fit, I need to take the LAST > > paragraph of the Request/Data/Para and the Closure to the next page. This > > works in many cases, but sometimes, FOP squeezes the line-feeds (or takes away > > the empty lines) to accommodate the whole content in one page. If I have > > little larger contents, when it feels (I think) that it can not put all in a > > single page (even after squeezing), it works fine without trimming the line- > > feeds. > > > > Any help will be well appreciated. Thanks in advance. > > Here is a sample XSL - > > <xsl:template name="LetterBody"> > > <fo:block white-space-collapse="false" linefeed-treatment="preserve"> > > <xsl:for-each select ="Request/Data/Body/Para"> > > <xsl:if test="position()!=last()"> > > <xsl:if test="Text"> > > <fo:block font-size="10pt" font-family="Courier"> > > <xsl:call-template name="WriteASIS"> > > <xsl:with-param name="buffer" select="string (.)"/> > > </xsl:call-template> > > </fo:block> > > </xsl:if> > > </xsl:if> > > </xsl:for-each> > > </fo:block> > > </xsl:template> > > ... > > <xsl:template name="Closure"> > > <fo:block space-before="5mm" font-family="Courier" keep-together.within- > > page="always"> > > <xsl:for-each select="Request/Data/Body/Para[last()]/Text"> > > <xsl:call-template name="WriteASIS"> > > <xsl:with-param name="buffer" select="string(.)"/> > > </xsl:call-template> > > </xsl:for-each> > > <xsl:if test="NB21Request/Data/Closure/Text !=''"> > > <xsl:for-each select="Request/Data/Closure/Text"> > > <xsl:call-template name="WriteASIS"> > > <xsl:with-param name="buffer" select="string(.)"/> > > </xsl:call-template> > > </xsl:for-each> > > </xsl:if> > > </fo:block> > > </xsl:template> >
Dear Pascal: I am sorry I could not make my issue clear. I am also not sure what you mean by "short XSL-FO". I wish I could attach an image to demonstrate the issue. I have put some empty lines between each paragraph using empty <fo:block>. FOP is preserving these lines in many cases. However, in certain cases, it is taking them out and squeezes the texts together. AAA BBB becomes AAA BBB This typically happens, when FOP tries to fit all the texts in the same page.I have tried white-space-collapse="false" linefeed-treatment="preserve", but it does not help. I have a feeling that keep-together.within-page="always" might be overwriting the linefeed treatments. But keep-together.within-page="always" and linefeed-treatment="preserve" are in two different blocks. That's what I had shown in my xsl-fo snippet. Please help me how I can preserve these linefeeds. Thanks Lal --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org