"block" with Mixed Content

This section provides a tutorial example showing a 'block' with mixed content of text and child block-level formatting objects. Text will be processed in child blocks first. Then all child blocks will be stacked to produce the final parent block.

Normal, the content of a "block" formatting object is a paragraph of text. But you can also put other formatting objects as part of the content of a "block" formatting object.

If the content of a "block" formatting object is a mixture of text, inline-level formatting objects and block-level formatting objects, the final block area will be generated according to these rules:

Here is my tutorial example, block-with-Mixed-Content.fo, that has a "block" element with mixed content: text and blocks:

<?xml version="1.1" encoding="utf-8"?>
<!-- block-with-Mixed-Content.fo
 - Copyright (c) 2006 HerongYang.com. All Rights Reserved.
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:simple-page-master master-name="page" 
   margin="0.1in" page-height="4in" page-width="3in">
   <fo:region-body region-name="body" background-color="#eeeeee"/>
 <fo:page-sequence master-reference="page">
  <fo:flow flow-name="body">
   <fo:block margin="0.1in" padding="0.1in"
    border-width="1px" border-style="solid" 
    font-size="16pt" font-weight="bold">
    The Three Little Pigs
   <fo:block margin="0.1in" 
    border-width="1px" border-style="solid" 
    First paragraph:
    <fo:block margin="0.1in" padding="0.1in"
     border-width="1px" border-style="solid" 
     background-color="#eeffff" text-align="justify">
     Once upon a time there were three little pigs who lived 
     with their Mother.
    Second paragraph:
    <fo:block margin="0.1in" padding="0.1in"
     border-width="1px" border-style="solid" 
     background-color="#ffffee" text-align="justify">
     Early one morning they woke up and their mother said, 
     "you're too big for this house and its time you left home."
   <fo:block border-width="1px" border-style="solid"/>

When you process the above sample XSL-FO document to a PDF file and open it, you will see a big block area that contains some text and two child blocks:

'block' with Mixed Content
"block" with Mixed Content

Table of Contents

 About This Book

 Introduction of XSL-FO

 Apache™ FOP (Formatting Objects Processor)

 RenderX XEP as an XSL-FO Tool

 Introduction of Area Model

 XSL-FO Document Basics and Examples

 Page Layout Masters

Block-Level Formatting Objects

 What Are Block-Level Formatting Objects

 What Is "block" Formatting Object?

 "block" Formatting Object Examples

 Margin Collapsed between Block Areas

 space-before/space-after vs. Margin

 Block Splitting for Page Break

"block" with Mixed Content

 Controlling White Space Characters

 What Is "block-container" Formatting Object?

 Inline-Level Formatting Objects

 Including Graphics in XSL-FO document

 Table of Rows and Columns

 List, Item, Label, and Body

 Floating Blocks - "float" and "footnote"

 Hyperlinks, Table of Contents and Indexes

 Headers and Footers using "static-content"

 Font Attributes and Font Families

 Apache FOP Font Configurations

 RenderX XEP Font Configurations

 Converting HTML to PDF


 Full Version in PDF/ePUB