Re: [xsl] [FO] Margin when a block breaks over a page

Subject: Re: [xsl] [FO] Margin when a block breaks over a page
From: Kamal Bhatt <kbhatt@xxxxxxxxx>
Date: Tue, 19 Aug 2008 13:01:35 +1000
Thanks, I will give it a go. Pity XSL FO does not support this concept, hopefully, this is something that will make it into the new version of the specification.
At 2008-08-19 10:42 +1000, Kamal Bhatt wrote:
I want to ensure that when a block breaks on a new page, the top of the content has a certain amount of spacing before it, how can I do this?

XSL-FO will put widowed lines of a block at the top of the main reference area in the region body ... there is no way I can think of to push those lines below the top margin of the body.


I have tried using space-before and and played with margins, but to no avail (that said, I am using FOP which hasn't got full space-before support yet).

I am not familiar with the facilities in FOP.


I cannot put the margin at the top of the region body because I have a background image.

But you can position the background image offset from the margin of the region body.


The example below has the lines of text starting at 15mm from the top edge of the page and the image is offset higher by 20pt so you can see 20pts of the image above the top line. Without the background-position-vertical= property of a negative value the top of the image would have lined up with the top line at the top of the body region.

So set your body margin where you want your text to wrap and then calculate a negative offset to position the top of your background higher.

I'm looking at working results in Antenna House ... I cannot vouch for FOP.

I hope this helps.

. . . . . . . . . . . . Ken

<?xml version="1.0" encoding="US-ASCII"?><!--background.fo-->
<root xmlns="http://www.w3.org/1999/XSL/Format";
      font-family="Times" font-size="20pt">

<layout-master-set>
<simple-page-master master-name="frame"
page-height="297mm" page-width="210mm"
margin-top="15mm" margin-bottom="15mm"
margin-left="15mm" margin-right="15mm">
<region-body region-name="frame-body" background-image="harbour.jpg"
background-position-vertical="-20pt"
background-repeat="no-repeat"/>
</simple-page-master>
</layout-master-set>


<page-sequence master-reference="frame">
<flow flow-name="frame-body" xmlns="http://www.w3.org/1999/XSL/Format";>
<block>This is a test</block>
</flow>
</page-sequence>
</root>




--
Upcoming XSLT/XSL-FO hands-on courses:      Wellington, NZ 2009-01
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal




--
Kamal Bhatt

Current Thread