In addition to controlling the spacing as described in the section “List spacing”, you have control over the list numbering style and starting number.
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
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>
...
This will result in the following print output:
1. First outer item. 2. Second outer item. 2.a. First 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 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 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. This attribute will override a continuation="continues"
attribute if there is one on the same list.
DocBook XSL: The Complete Guide - 3rd Edition | PDF version available | Copyright © 2002-2005 Sagehill Enterprises |