1<xsl:stylesheet version="1.0"
2      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3      xmlns:fo="http://www.w3.org/1999/XSL/Format">
4
5<xsl:strip-space elements="orderedlist"/>
6
7<xsl:template match="orderedlist/listitem">
8  <fo:list-item indent-start='2pi'>
9    <fo:list-item-label>
10      <xsl:variable name="level"
11		    select="count(ancestor::orderedlist) mod 3"/>
12      <xsl:choose>
13	<xsl:when test='$level=1'>
14	  <xsl:number format="i"/>
15	</xsl:when>
16	<xsl:when test='$level=2'>
17	  <xsl:number format="a"/>
18	</xsl:when>
19	<xsl:otherwise>
20	  <xsl:number format="1"/>
21	</xsl:otherwise>
22      </xsl:choose>
23      <xsl:text>. </xsl:text>
24    </fo:list-item-label>
25    <fo:list-item-body>
26      <xsl:apply-templates/>
27    </fo:list-item-body>
28  </fo:list-item>
29</xsl:template>
30</xsl:stylesheet>
31