In addition to controlling the spacing as described in the section “List spacing”, you have control over the list numbering style and starting number, as well as print format properties.
The stylesheets support list numbering using arabic and roman numerals, as well as uppercase and lowercase letters. If all you want is the numbering style to change for nested orderedlist
elements, then the stylesheet already handles that. It nests number styles automatically according to the following sequence:
1, 2, 3 a, b, c i, ii, iii A, B, C I, II, III
If you want to specify a numbering style for a given orderedlist
, then add a numeration
attribute to the list as in the following example:
<orderedlist numeration="upperalpha">
<listitem>
...
The allowed values for the numeration
attribute are as follows:
arabic loweralpha lowerroman upperalpha upperroman arabicindic
If you want to change the order in which these styles are used in nested numbered lists, you need to customize the template named next.numeration
located in common/common.xsl
. That template takes a numeration
name as a parameter, and returns the value that should follow at the next level.
The FO stylesheet also supports the inheritnum="inherit"
attribute on an orderedlist
. When that attribute is added to an orderedlist
that is nested inside another orderedlist
, then the inner list's numbering will inherit the outer listitem
's number as a prefix. The following example shows how the attribute is used:
<orderedlist>
<listitem><para>First outer item.</para></listitem>
<listitem><para>Second outer item.</para>
<orderedlist inheritnum="inherit">
<listitem><para>First inner item.</para></listitem>
<listitem><para>Second inner item.</para></listitem>
...
This will result in the following print output:
1. First outer item. 2. Second outer item. 2.a. First inner item. 2.b. Second inner item. ...
This inherit feature does not work for HTML output, because there is no way to specify such a numbering style in HTML markup. It can be done with CSS, though.
When using orderedlist
s, there may be situations where you need to continue the numbering from one list to the next, with material intervening between them. The stylesheets support the use of the continuation="continues"
attribute on the orderedlist
element. When that attribute is added, that list will not start at number 1, but will instead continue from the end of the closest previous orderedlist
in the document. The following example shows how to mark up your document:
<orderedlist> <listitem><para>First item in first list</para></listitem> <listitem><para>Second item in first list</para></listitem> </orderedlist> (other content) <orderedlist continuation="continues"> <listitem><para>First item in continued list</para></listitem> <listitem><para>Second item in continued list</para></listitem> </orderedlist>
This will result in the following output:
1. First item in first list
2. Second item in first list
(other content)
3. First item in continued list
4. Second item in continued list
The continuation feature does work in HTML output as well.
When using orderedlist
, there may be situations where you need to manually set the starting number for a list. You can do that in two different ways:
With a start
processing instruction added inside the orderedlist
element, as in the following example:
<orderedlist>
<?dbfo start="8"?><?dbhtml start="8"?>
<listitem>
...
If you want consistent numbering in both print and HTML output, you need to add both dbfo
and dbhtml
processing instructions.
With an override
attribute on the first listitem
element, as in the following example:
<orderedlist>
<listitem override="8">
...
The stylesheet will number the first list item with 8
and continue from there for subsequent list items. This attribute will override a continuation="continues"
attribute if there is one on the same list.
Starting in DocBook version 5, the orderedlist
element accepts a startingnumber
attribute to achieve the same purpose.
For print output, the stylesheet provides a pair of attribute-sets that let you add formatting properties to orderedlist
elements.
The orderedlist.properties
attribute-set lets you set font properties and side margins for the whole list. It is applied to the fo:list-block
that contains the output list. As such, its properties do not apply to the optional list title or other child elements before the first listitem
.
The orderedlist.label.properties
attribute-set lets you set font properties for the item number. This is useful if you want to change the font family, size or color of the number. The attribute-set is applied to each fo:list-item-label
in the output list.
DocBook XSL: The Complete Guide - 4th Edition | PDF version available | Copyright © 2002-2007 Sagehill Enterprises |