xsl-list
[Top] [All Lists]

[xsl] Trouble positioning "fo:block" at the bottom of the page

2011-02-07 03:26:06
L.S.

First of all, I must 'warn' you; I'm very new to XSL-FO.
So, it could be that my question is already covered elsewhere, or that the 
answer to my question is just common knowledge to experienced XSL-FO stylers.

My question:
I want a piece of text (sort of final notes in a brochure) to appear at the 
bottom of the last page if that page has room for it. If there is no room for 
it, I want it to appear at the next page, but also at the bottom of it. This 
means that when the regular content of the brochure has reached the end, I add 
the 'final notes'. 
Suppose these 'final notes'  take up a third of a page, and the last piece of 
regular content is less then two thirds of the page, the 'final notes' have 
enough room to be put on the bottom of the same page where the regular content 
ended. When the regular content fills more than two thirds of the last page, 
there is not enough room for the 'final notes' to be put there, and in that 
case the 'final notes' must appear on the bottom of the next page.
I have tried a lot of different scenarios to accomplish this, but it means 
mostly two situations:
1.      The 'final notes' are actually put at the bottom of the last page, but 
overlapping the regular content 
2.      The 'final notes' are put on a separate page but at the top of it.

After a lot of 'trial and error' I gave up, and created a new 
'fo:page-sequence' with the sole purpose to put the 'final notes' always at the 
bottom of a newly created page (which is then the last page). This can lead to 
a situation where the regular content ends with only four or five lines of 
content (so there is enough room on that page for the 'final notes'), and on a 
brand new page the 'final notes' are placed. This is not acceptable.

This is the XSL-FO code I'm working on (the 'final notes' are called 
'extrainfo'). As you can see I use the 'absolute position="fixed" and 
'bottom="0pt"' to put this block of content at the bottom of the page.

       <xsl:template match="extrainfo">
             <fo:block-container keep-together.within-page="always" left="10pt" 
space-before="24pt" absolute-position="fixed" bottom="0pt"> 
                    <fo:block-container >
                           <fo:block font-size="{$FontSizeNormal}" 
letter-spacing="{$LetterSpacing}" line-height="{$LineHeight}" 
font-weight="normal" ><xsl:apply-templates select="extrabody"/></fo:block>
                    </fo:block-container>
             </fo:block-container>
       </xsl:template>

In my 'fo:page-seqeunce' I use the following code:
As you can see I put the 'extrainfo' as the last part in the first 'fo:flow'. 
This works as long as I don't use the 'absolute position="fixed"' in the 
'fo:block-container'.  In this case the content of 'extrainfo' is put at the 
bottom, but overlaps exisiting content.

       <fo:page-sequence master-reference="Leaflet" 
font-family="MyriadPro-Regular" hyphenate="true" language="nl" widows="2" 
orphans="2" hyphenation-push-character-count="3" 
hyphenation-remain-character-count="3" initial-page-number="1">
             <fo:flow flow-name="xsl-region-body">
                    <fo:block language="nl" country="nl">
                           <xsl:apply-templates select="head" />
                           <xsl:apply-templates select="afsprakenblok" />
                           <xsl:apply-templates select="body" />
                           <xsl:apply-templates select="extrainfo" />
                           </fo:block>
             </fo:flow>
       
             <fo:static-content flow-name="A4-footer">
                    <fo:block margin-top="17.5pt" border-width="0.5pt" 
border-color="black" border-top-style="solid" border-bottom-style="none" 
border-left-style="none" border-right-style="none">
                           <fo:block margin-top="2.65mm" 
font-size="{$FontSizeNormal}" letter-spacing="{$LetterSpacing}" >
                                  <xsl:apply-templates select="footer/strong" 
/>, <xsl:apply-templates select="footer/footerafdeling" />, 
<xsl:apply-templates select="footer/footernummer" />/ <xsl:apply-templates 
select="footer/footerdatum" />
                                  <fo:block margin-top="-3mm" text-align="end" 
font-size="{$FontSizeNormal}">
                                        <fo:page-number />
                                  </fo:block>
                           </fo:block>
                    </fo:block>
             </fo:static-content>
             
             <fo:flow flow-name="Location">
                    <fo:block margin-top="275pt" margin-left="5mm" 
<xsl:apply-templates select="locatie"/></fo:block>
             </fo:flow>
       </fo:page-sequence>

(Oh, and don't get fooled by all the Font definitions. I now know how to 
separate these and put them in a single XSL file.)

By the way, I don't know how much content goes in the regular content and how 
much goes in the 'extrainfo' or 'final notes'. So I cannot work with strict 
mathematics. 
Any help on my question would be greatly appreciated. And if someone needs to 
see more code or whatever, please let me know.


Met vriendelijke groet,
 
Toon van der Struijk 
Elektronicaweg 31
2628 XG Delft, Nederland
aecvanderstruijk(_at_)seneca(_dot_)nl 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>