xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lal Mohanty <lmoha...@yahoo.com>
Subject Erratic behavior of keep-together.within-page="always"
Date Fri, 17 Feb 2012 00:19:47 GMT
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>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message