Re: [xsl] FO: block, padding and border

Subject: Re: [xsl] FO: block, padding and border
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 18 Nov 2008 11:39:42 -0500
At 2008-11-18 16:58 +0100, Florent Georges wrote:
  I have a form in FO, which is a sequence of blocks and tables,
each with a border.  Within blocks, I use padding="2pt" to
prevent words to touch the border.  But doing so, the border of
the block is moved by 2pt (to the outside of the block.)

Right ... check out my book you bought on pages 92 and 95.


  You can see the following screenshot to see the result:
http://www.fgeorges.org/tmp/fo-block-padding.jpg.

  Of course, the borders should be aligned.  How would you do
that?

By using space-before= and space-after= for top and bottom, and start-indent= and end-indent= for left and right.


I can think about workarounds, like using a table with
one cell instead of a block, but I would like to do it the clean
way...

In XSL-FO using padding is rarely the "clean way" ... in fact I've never been forced to use it in my production work ... and it has repercussions when playing with backgrounds (the background of padding is the background of the child object, not the background of the parent).


The diagram on page 92 shows the use of start-indent=, end-indent=, space-before= and space-after= ... the diagram on page 95 shows the use of padding and borders.

Note when using space-before= and space-after= that you are at the start and end of a reference area (the table cell), so you need to specify a conditionality of retain.

I hope this helps.

. . . . . . . . . Ken

--
Upcoming XSLT/XSL-FO, UBL and code list hands-on training classes:
:  Sydney, AU 2009-01/02; Brussels, BE 2009-03; Prague, CZ 2009-03
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video sample lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg
Video course overview:  http://www.youtube.com/watch?v=VTiodiij6gE
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

Current Thread