What Are "page-number*" Formatting Objects?

This section describes 'page-number', 'page-number-citation', and 'page-number-citation-last', which are inline-level formatting objects that generates inline areas with the current page number, or page numbers of cited formatting objects.

What Is "page-number" Formatting Object? "page-number" is an inline-level formatting object that generates an inline area with the page number of where is area is located.

What Is "page-number-citation" Formatting Object? "page-number-citation" is an inline-level formatting object that generates an inline area with the page number of the first location of the formatting object cited by the "ref-id" attribute.

What Is "page-number-citation-last" Formatting Object? "page-number-citation" is an inline-level formatting object that generates an inline area with the page number of the last location of the formatting object cited by the "ref-id" attribute.

Note that to cite a formatting object, the ref-id="..." attribute value must match the id="..." attribute value of the cited formatting object as illustrated below:

<fo:page-number-citation ref-id="id_1" .../>
...
<fo:block id="id_1" ...>
...cited block...
</fo:block>

Here is my XSL-FO example, page-number-Formatting-Objects.fo with "page-number", "page-number-citation", and "page-number-citation-last" formatting objects:

<?xml version="1.0" encoding="utf-8"?>
<!-- page-number-Formatting-Objects.fo
 - Copyright (c) 2016, HerongYang.com, All Rights Reserved.
-->
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
 <fo:layout-master-set>
  <fo:simple-page-master master-name="page" 
   margin="0.1in" page-height="3.3in" page-width="2.55in">
   <fo:region-body region-name="body" background-color="#eeeeee"/>
  </fo:simple-page-master>
 </fo:layout-master-set>
 <fo:page-sequence master-reference="page">
  <fo:flow flow-name="body">
   <fo:block id="first" margin="0.08in" font-size="10pt" 
    break-before="page">
Page <fo:page-number font-size="20pt" color="#ff0000"/>: 
So the first pig made a house of straw. 
Unfortunately a wolf came creeping by. 
“Little pig, little pig let me come in.”
“No, no, no by the hairs on my chinning chin chin, I’ll not let you 
in.” “Then I’ll huff and I’ll puff and I’ll blow your house in.”
So the wolf huffed and he puffed and he bl
ew the house in. 
So the first little pig ran away to join his brothers. 
   </fo:block>
   <fo:block margin="0.08in" font-size="10pt">
Read second pig on page <fo:page-number-citation ref-id="second" 
font-size="14pt" color="red"/>,
or third pig on page <fo:page-number-citation ref-id="third" 
font-size="14pt" color="red"/>.
   </fo:block>
   <fo:block id="second" margin="0.08in" font-size="10pt" 
    break-before="page">
Page <fo:page-number font-size="20pt" color="#ff0000"/>: 
Now, the second little pig had made his house out of sticks. 
Unfortunately a wolf came creeping by. 
“Little pig, little pig let me come in.”
“No, no, no by the hairs on my chinning chin chin, I’ll not let you 
in.” “Then I’ll huff and I’ll puff and I’ll blow your house in.”
So the wolf huffed and he puffed and he blew the house in. 
So the first little pig and the second little pig ran away to find 
their brother. 
   </fo:block>
   <fo:block id="third" margin="0.08in" font-size="10pt" 
    break-before="page">
Page <fo:page-number font-size="20pt" color="#ff0000"/>: 
Now, the third little pig had made his house out of bricks. 
Unfortunately a wolf came creeping by. 
“Little pig, little pig let me come in.”
“No, no, no by the hairs on my chinning chin chin, I’ll not let you 
in.” “Then I’ll huff and I’ll puff and I’ll blow your house in.”
So the wolf huffed and he puffed and he huffed and he puffed, 
but luckily he could not blow the house down. 
   </fo:block>
  </fo:flow>
 </fo:page-sequence>
</fo:root>

If you process this example XSL-FO document with Apache FOP tool and view the output, you will see that cited page numbers are displayed in red:

"page-number*" Formatting Objects

Last update: 2016.

Table of Contents

 About This XSL-FO Tutorial 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

Inline-Level Formatting Objects

 What Are Inline-Level Formatting Objects?

 What Is "inline" Formatting Object?

 "inline" Splitting for Line Break

 What Is "line-height" Attribute?

 What Is "baseline-shift" Attribute?

 "inline" with Mixed Content

 FOP Failed on "block" inside "inline"

 What Is "inline-container" Formatting Object?

 What Is "charecter" Formatting Object?

 What Is "leader" Formatting Object?

What Are "page-number*" 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

 References

 PDF Printing Version