[xep-support] Conditionally outputting a block

Alexander Peshkov peshkov at renderx.com
Thu Nov 27 06:28:33 PST 2003


Hello James,

I think I got it now. Generally speaking you want to select a
page-master based on the content (amount of content) on the page and
there is no such means in XSL FO. However I can suggest a workaround
which will probably do the trick. It is based on markers and can
be done in a two flavors. First of all you need separate your section
into unequal parts (second part should be merely a half of the page
long) and wrap every part in a block. Place markers with the same
'marker-class-name' at very beginning of the each block. First marker
should be empty and second marker should contain in a body optional
('pop-up') text which have to be displayed on the last page of the
section if there is some space left. Now you have to retrieve this
content and that's where those two flavors come into the game:
1. Simpler, but (probably) less safe approach:
   Whole section is formatted using the same page-master which has a
   great extent on fo:region-after overlapping part of the
   fo:body-region. In the static content corresponding to this region
   you have to put fo:retrieve-marker with retrieve-position="first-including-carryover"

It will retrieve empty string on all pages, but on the last one it
will retrieve second marker content if the page break happened after
the second marker (that means we have a little of actual content on
this page). The positive about this approach is that it would work
even if you have a number of sections in a single page-sequence and
new section started with explicit page-break. And you do not need any
special page-masters at all. On the downside, this approach could
interfere with other footers in fo:region-after if they used along the
page-sequence. 

2. A little bit more complicated (but maybe 'cleaner') approach:
   You have to wrap every section in a separate page-sequence with
   special page-master for the last page defined as described above
   (with great fo:region-after extent).
   In the static content corresponding to this region you have to put
   fo:retrieve-marker as in the first approach.
   This way all the pages of the sequence except for the last one will
   be rendered as usually using any geometry and fo:retrieve marker
   will fire only for the last page.

Note that the whole thing will work only if your sections are longer
then one page.

All in all it's not that elegant solution, but it's the only one I can
think of. Please find simple example attached.

Best regards,
Alexander Peshkov                             mailto:peshkov at renderx.com
RenderX


JM>> Simple question (probably demanding of a fiendishly clever
JM> answer...):

>> I can't say that I understand your problem well...

JM> I'll try again (-:

JM> I have a document that generates very nicely - It consists of multiple
JM> sections which have the same formatting - most sections cover several
JM> pages, within each sections are items that are kept together. Each
JM> section starts on a new page to aid the reader in locating the
JM> information they require. This all works, the pagination is perfect,
JM> keep-together does exactly what is needed, (I have page numbering, odd
JM> and even page headers and footers, and even a page which switches from 1
JM> column to two for a nice toc/index). The easy stuff I've more or less
JM> got nailed (-: I will definitely have it nailed after I've done the next
JM> document (same theory, more complex formatting rules).

JM> Now the challenge:

JM> When the document is generated there is usually a large chunk of blank
JM> white space on the last page of each section - this is to be expected as
JM> there is a page break before a section starts. It would be nice if I
JM> could stick something into that white space when - and only when - there
JM> is sufficient space for it to fit (for extra credit one would fit one of
JM> a choice of somethings depending on the size of the available space).
JM> Which was, I thought, fairly well expressed by:

JM>> Question - is it possible to define a block (or even better, blocks
JM>> plural) that are only output if there is room for them on the
JM> "current"
JM>> page?

JM> The aim is to do something useful with the blank spaces without having
JM> to resort to post processing the document with a full blown copy of
JM> acrobat as we want to be able to regenerate the document in a
JM> semi-automatic fashion.

JM> James Murphy


JM> -------------------
JM> (*) To unsubscribe, send a message with words 'unsubscribe xep-support'
JM> in the body of the message to majordomo at renderx.com from the address
JM> you are subscribed from.
JM> (*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pop-up.fo
Type: text/xml
Size: 12180 bytes
Desc: not available
URL: <http://lists.renderx.com/pipermail/xep-support/attachments/20031127/b8506c91/attachment.xml>


More information about the Xep-support mailing list