Re: Simple, but...

At 2003-06-27 17:10 -0700, Mark Lundquist wrote:
>I have this box, see... and I want that box divided into a left part and a 
>right part.  Each of these parts gets some text inside it.

If the content of the left box needs to "flow" into the right box, then the 
entire box will have to be your body region.  I've had students who needed 
this one effect in a small area on a large poster-sized presentation in one 
corner ... they just used bizarre margins to place the multi-column region 
body in the corner, and then placed everything else with absolutely 
positioned block containers.

>So far, no matter what I try, the two "parts" always stack vertically 
>instead of being packaged side-by-side.

Right ... because blocks are as wide as their parents.

>If this were HTML, I would probably use two div elements floated to the 
>left within a containing div, while my old-school colleague for whom table 
>abuse is the only way to style a page, would make a table with one row 
>containing two cells.  Simple.  So how, how, how, do I accomplish this in 
>XSL-FO?

The simple way is to use the construct I call in class the "pair of 
inline-direction aligned block-level areas" defining content for the 
"member of the pair on the start side" and content for the "member of the 
pair on the end side".  This construct will put two block-level areas 
beside each other, thus creating the parent areas in which the two sets of 
blocks can be independently placed.  The blocks can be any size, any width 
(though not overlapping with the block areas to the side).

I demonstrate the use of this for side-by-side bilingual text (a common 
requirement in Canadian government content publishing).  If you download 
the free preview of our XSL-FO book from our web site, check on pages 78 
and 79 for an illustration of this.

The name for this construct in XSL-FO is the "list" construct ... but there 
is so much baggage with the word "list" that people think it only means 
traditional list formatting ... for which it is good to use, but it is also 
good to use for *any* time you need a pair of block-level layout areas in 
the inline-progression direction.

So, use a list-block with a list-item putting the "left" text in the 
list-item-label block-level area and the "right" text in the list-item-body 
block-level area, and make the two block areas the same size.  Just because 
it is called "list" doesn't mean the label has to be smaller than the body.

Many people don't realize the utility of the list construct, and indeed, 
there are a number of constructs in XSL-FO for which the names happen to 
characterize a specific purpose, yet the layout areas can have many 
alternative purposes.

I wonder if the committee had called the constructs <pair-block>, <pair>, 
<pair-start> and <pair-end> instead of <list-block>, <list-item>, 
<list-item-label> and <list-item-body> that more people might recognize the 
utility of them.

I hope this helps.

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

--
Upcoming hands-on courses: in-house corporate training available;
North America public:  XSL-FO Aug 4,2003; XSLT/XPath Aug 12, 2003

G. Ken Holman                mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/f/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                      Definitive XSLT and XPath
ISBN 0-13-140374-5                              Definitive XSL-FO
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X              Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners:    http://XMLGuild.info
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc

Received on Saturday, 28 June 2003 11:58:56 UTC