Eric,
 
You should use keep-with-next on title (or keep-with-previous on 1st para), 
that should do the trick.
 
Pascal

        -------- Message d'origine-------- 
        De: Lewis, Eric [mailto:[EMAIL PROTECTED] 
        Date: mer. 19/09/2007 16:33 
        
        

        Hi
        
        I'm having again a problem of page breaks and keeping things together (I
        last wrote to this list in June 07).
        
        I have a paragraph with a title and a body afterwards that must be kept
        together if possible. As a fix to my last problem, I check whether the
        title and body should be kept together always or whether I let FOP do
        the page breaks.
        
        This means I have something like
          <xsl:template match="histTxt">
            <fo:block>
              <xsl:choose>
                <xsl:when test="string-length(.) > $maximumLength">
                  <xsl:attribute name="keep-together">auto</xsl:attribute>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:attribute name="keep-together">always</xsl:attribute>
                </xsl:otherwise>
              </xsl:choose>
              <xsl:apply-templates />
            </fo:block>
          </xsl:template>
        
        In apply-templates, some escaped pseudo-HTML is converted into XSL-FO,
        so at the end I have something like
        <fo:block keep-together="always">
           <fo:inline font-weight="bold">my title</fo:inline>
           <fo:block/>my body bla bla bla bla bla<fo:block></fo:block>
        </fo:block>
        
        and for really long texts
        <fo:block keep-together="auto">
           <fo:inline font-weight="bold">my other title</fo:inline>
           <fo:block/>Really, really long text, much longer than I care to type
        here...<fo:block></fo:block>
        </fo:block>
        
        Most of the blocks are used for breaks, as you can see.
        
        However, my problem is that at some point, the bold title is standing on
        its own, and the body appears on the next page, like
        
        my other title
        --------------------------- page break
        Really, really long text,
        much longer than I care to
        type here...
        
        Not really nice! :-)
        But hey, that's what orphans and widows are for, but after using them:
        
          <xsl:template match="histTxt">
            <fo:block>
              <xsl:choose>
                <xsl:when test="string-length(.) > $maximumLength">
                  <xsl:attribute name="keep-together">auto</xsl:attribute>
                  <xsl:attribute name="orphans">3</xsl:attribute>
                  <xsl:attribute name="widows">3</xsl:attribute>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:attribute name="keep-together">always</xsl:attribute>
                </xsl:otherwise>
              </xsl:choose>
              <xsl:apply-templates />
            </fo:block>
          </xsl:template>
        
        The result is much worse, the titles appear as orphans all over the
        place. Besides, as I understand the default is 2, so this should never
        happen (?)
        
        I'm certainly doing something wrong, but what? I'd be glad for any hints
        :-)
        
        Best regards,
        Eric
        

<<winmail.dat>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to