Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

XSL-FO list


May 28, 2021 XSL-FO


Table of contents


XSL-FO list


How do I define a list in XSL-FO?

XSL-FO defines the list using the elements of the .lt;fo:list-block-gt;


XSL-FO List Block (List Blocks)

There are four XSL-FO objects that you can use to create a list:

  • fo:list-block (contains the entire list) (contains the whole list)
  • fo:list-item (contains each item in the list) (contains each item in the list)
  • fo:list-item-label (contains a label for list-item - typically, contains a number or character.
  • fo:list-item-body (content/body containing list-item - typically, one or more objects)

An example of an XSL-FO list:

<fo:list-block>

<fo:list-item>
<fo:list-item-label>
<fo:block>*</fo:block>
</fo:list-item-label>
<fo:list-item-body>
<fo:block>Volvo</fo:block>
</fo:list-item-body>
</fo:list-item>

<fo:list-item>
<fo:list-item-label>
<fo:block>*</fo:block>
</fo:list-item-label>
<fo:list-item-body>
<fo:block>Saab</fo:block>
</fo:list-item-body>
</fo:list-item>

</fo:list-block> 

The output of the code above looks like this:

* Volvo
* Saab

Read about it

XSL-FO list-item object