Re: [xsl] Nested Blocks including inline Text

Subject: Re: [xsl] Nested Blocks including inline Text
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 05 Sep 2005 21:16:39 -0400
At 2005-09-06 11:01 +1000, Kevin Frey wrote:
I am building a rudimentary XSL-FO formatter in C++, initially targeting
only the simpler elements of XSL-FO.

Have you considered, rather, contributing to the http://xmlroff.sf.net project? It is an XSL-FO formatter written in C.


I understand that fo:block can include other fo:block elements, such as the
following:

<fo:block>
  <fo:block>
     Some text
  </fo:block>
</fo:block>

Yes, indeed.


If an fo:block element X contains a nested block, can X also contain inline
elements, for example:

<fo:block>
  Text before a child block.

  <fo:block>
     Some text
  </fo:block>

  Text after a child block.
</fo:block>

Yes, indeed.


In this situation, what is the layout behaviour?

The nested <block> creates a new set of lines, thus starting "Some" at the beginning of a new line. XSL-FO rules for collapsing leading and trailing space are engaged if not touched by the stylesheet, so you would end up seeing:


Text before a child block.
Some text.
Text after a child block.

I cannot find any explicit
reference to the layout behaviour in the specification under this
circumstance,

Section 4.4.1 states that for *each* block area it is aligned accordingly within the parent area. Each block area is as wide as the parent, so the nested block's line stacks below the first block's line. The first block's second line needs a line area, and it needs to be as wide as the parent, so it stacks below the nested block.


I believe that the stacking rules define all of this. And there are many interactions of property settings for traits that will impact the stacking and placement of block areas.

or even whether the above construct is legal.

It is legal.


I hope this helps.

. . . . . . . . Ken

--
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread