Sönke Ruempler wrote:
As most of you know, the keep-directives only work with table workaround.
So my question is, if i can create a xslt template for this:
<h1>title</h1>
<p>blah blub</p>
So that h1 never breaks with the next element. I have working templates für
h1 and p.
I am no XSLT expert so maybe anyone did that before ...
You have to create a blind table, enclosing the two elements:
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="proportional-column-width()"/>
<fo:table-body>
<fo:table-row keep-with-next="always">
<fo:table-cell>
<fo:block>title</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>blah blub</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
If you want to keep all h1 elements with the following element, you have
1. Process the following element from the template which processes the
h1
2. Somehow arrange the elements following a h1 aren't processed twice.
How to do either depends on how you process the sourcce in general.
For the first, you can start with
<template match="h1">
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="proportional-column-width()"/>
<fo:table-body>
<fo:table-row keep-with-next="always">
<fo:table-cell>
.... whatever you need to process the h1 content here...
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<xsl:apply-templates select="following-sibling::*"/>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
The second point is trickier. The most easy way is to exclude
the elements following h1 elements in the apply-templates of
the parent element:
<xsl:apply-templates
select="*[not(preceding-sibling::*[1][self::h1])]"/>
There are various other possiblities, ranging from moded templates
to using control parameters. There is no universal "best solution".
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]