Welcome to our free Introduction to XSL-FO tutorial. This tutorial is based on Webucator's Introduction to XSL-FO course.
Often you will want to make sure that certain content is kept together. For example, a paragraph following a heading should stay with that heading. This type of thing is handled with the keep attributes described below.
The keep-with-previous attribute instructs the processor to try to keep an FO on the same page, column and line as the previous FO. Similarly, the keep-with-next attribute instructs the processor to try to keep an FO on the same page, column and line as the following FO. You can be more specific by appending .within-line, .within-column, or .within-page to the attribute (e.g, keep-with-next.within-page). Possible values for these attributes are shown below:
The keep-together attribute is used to keep chunks of content together.
Note that breaks take precedence over keeps.
Orphans are lines of text left at the end of a page. Widows are lines of text that carry over to the next page. The orphans and widows attributes are used to enforce a minimum number of orphans and widows in a block. For example, the code below specifies that the content should have no fewer than three orphans and three widows.