Re: [xsl] Empty fo:block legal?

Subject: Re: [xsl] Empty fo:block legal?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 21 Mar 2009 08:11:57 +0100
At 2009-03-20 15:11 -0700, Karl Stubsjoen wrote:
Is it legal to have an empty fo:block element? The standards suggest yes.

6.5.2 fo:block
http://www.w3.org/TR/xsl/#fo_block

(#PCDATA|%inline;|%block;)*

Assuming the * is 0 more child elements.

Not only legal, but also very commonly used.


An empty <block> construct interrupts the flow in the block-progression-direction and begins a new line. So in some ways, you can treat an empty <block/> as if it were a single HTML <br/> or <div/> element:

   <block>
      This is a line of text <block/>This is a second line.
   </block>

But note that an empty block has zero height, so having two <block/> constructs in a row does not act like two <br/> elements in a row. The following acts like two <br/> elements in a row which would leave a blank line, not just a break:

<block><leader/></block>

An empty block with a span is useful at the end of multi-page-column flows in order to end the multi-page-column span-reference-area and start a single-column span-reference-area. When done at the end of a chapter or a document, this will balance the content of that last page across all of the columns of the page, which makes for a better appearance than having only some of the columns filled on the start side of the page.

In XSL-FO 1.0 an empty block at the end of the flow is useful as an id= anchor for citing the last page number in most cases. But since not all cases can be covered in this regard, XSL-FO 1.1 has a new construct for citing the last page of a document.

One last note: there is always room for an empty block at the bottom of a page, even if the page is full of content. This is important when working with markers, such as having the "continued..." marker not show up at the bottom of the page when the flow associated with the marker happens to end at the very bottom of the page.

I hope this helps. I think there are other examples I go over with students, but this should give you an overview.

. . . . . . . . . . Ken

--
XSLT/XSL-FO/XQuery training in Los Angeles (New dates!) 2009-06-08
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
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