Reputation: 23
I am converting HTML with paragraphs followed by blockquotes into FO using XSL.
How can I avoid page breaks between the paragraphs and the blockquote that follows?
Page breaks following the blockquotes are fine.
Example:
<p> Some paragraph..</p>
<blockquote>My reference</blockquote>
<p> Another paragraph..</p>
<blockquote>My reference</blockquote>
Upvotes: 2
Views: 1621
Reputation: 3788
You need what is called a keep condition between the block generated by a normal p
and the one generated by a blockquote
.
In particular, as p
is a general-purpose tag, I think the best option is to use the attribute keep-with-previous.within-page="always"
in the fo:block
generated for the blockquote
HTML element.
If you are using XSLT to create the XSL-FO output, you need something like this (you may need to adjust namespaces):
<xsl:template match="blockquote">
<fo:block keep-with-previous.within-page="always" ...other attributes...>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
Upvotes: 1
Reputation: 7519
I think the most straightforward way would be to wrap the elements you want to keep together with a fo:block
, and add a keep-with-next.within-page="always"
attribute, as shown here:
<fo:block keep-with-next.within-page="always">
... content of p and blockquote elements
</fo:block>
Upvotes: 0