Creating XSL-FO Lists

As you saw in Chapter 11, XSL-FO tables work much as they do in HTML, and it turns out that lists do, too. Just as in HTML, an XSL list displays a vertical list of items. You use four XSL-FO elements to create lists:

  • <fo:list-block>

  • <fo:list-item>

  • <fo:list-item-label>

  • <fo:list-item-body>

You enclose the whole list in an <fo:list-block> element, and each item in the list in an <fo:list-item> element.To create a label for the list item, you use an <fo:list-item-label> element, and to insert the actual data for each list item, you use an <fo:list-item-body> element.

Here’s an example, lists.xsl, that transforms planets.xml into XSL-FO list format, with each list item displaying the name of a planet:

Listing 12.1. lists.xsl

Get Inside XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.