Hi It turns out that a combination of checking the text length and keeping title and body together does the trick.
I remember that Jeremias said that integer values for keep-together etc. were kind of supported (not officially, though). Anyway, thanks for the help! Best regards, Eric ________________________________ Von: Pascal Sancho [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 20. September 2007 09:52 An: fop-users@xmlgraphics.apache.org Betreff: RE : Page breaks and keeping blocks together Hi, What you need here are integer values for keep-together and keep-with-*. Unfortunately, FOP doesn't implement this yet. As a workaround, you can approximatively evaluate the text length and choose to keep or not... Pascal -------- Message d'origine-------- De: Lewis, Eric [mailto:[EMAIL PROTECTED] Date: jeu. 20/09/2007 08:11 Yes, but the problem there is: If I do that, the long body text will cause an overflow, and half of my text ends up in nirvana ;-) Best regards, Eric ________________________________ Von: Pascal Sancho [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 19. September 2007 16:47 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 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]