W3C home > Mailing lists > Public > www-xsl-fo@w3.org > July 2003

Re: Center block within block?

From: G. Ken Holman <gkholman@cranesoftwrights.com>
Date: Sun, 27 Jul 2003 13:14:57 -0400
Message-Id: <5.2.0.9.0.20030727115545.02d2cea0@pop.storm.ca>
To: www-xsl-fo@w3.org

At 2003-07-27 20:40 +0500, David Tolpin wrote:
> >
> > However ... the one way I can give you what I think you are asking for is
> > to centre an auto-width table.  You have to rely on the auto-width
> > algorithm as implemented by the processor to not wrap your lines, but as I
> > said I think your line is probably short.
> >
>
>For a single-line block, an inline in a block with text-aling="center"
>will do exactly the same. No need for table-based layout. For a multi-line
>block, I don't see how a table with table-layout="auto" can help.

I illustrate how a table with table-layout="auto" can help in the message:

   http://lists.w3.org/Archives/Public/www-xsl-fo/2003Jul/0017.html

Note how the border around the block has space between its start edge and 
its parent's start edge, and between its end edge and its parent's end edge.

I'm assuming the block that the original poster is talking about is a block 
of some content for some reason: he might have an explicit width on the 
block, it might be a very short line that needs to be bordered ... for some 
reason he is asking for a start and end indent *on a block*, not *on the 
text in a block*, so I'm making the supposition this is a special case not 
accommodated with inlines.

Actually, as I write this, I realize the same effect as the auto-width 
table can be accomplished with an inline-container, since an 
inline-container can contain an arbitrary block:

<block space-before="5cm" border="thin solid black"
        xmlns="http://www.w3.org/1999/XSL/Format">
   This is text in the outer space.
   <block text-align="center">
     <inline-container>
       <block border="thin solid black">
         and  centred  text (i-c).
       </block>
     </inline-container>
   </block>
   and more outer text
</block>

On Antenna House XSL Formatter the above produces the identical effect as 
the auto-width table, in that the nested block of text has a box around it 
and space entirely around the box inside the outer box of the outer block.

The original poster has not commented on my replies yet, so this is still 
all supposition on my part trying to help in a situation that isn't typical 
(otherwise the suggested simple answers would apply).  But all along I've 
been assuming that it isn't just the simple centring of text, but the 
desire to centre a block of some width less than the reference area in the 
centre of the inline-progression dimension of the parent area.

Again, if my suppositions are not correct (the original poster did not give 
a lot of detail), then my suggestions may not apply.

I hope this clarifies my efforts here.

.................... 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 Sunday, 27 July 2003 15:44:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:11 GMT