Nested list example

<?xml version="1.0"?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fo="http://www.w3.org/1999/XSL/Format"
>

<xsl:template match="doc">
  <fo:block>
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

<xsl:template match="p">
  <fo:block>
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

<xsl:template match="list">
  <fo:list-block space-before="10pt"
                 provisional-distance-between-starts="3pc"
                 provisional-label-separation="1pc">
    <xsl:apply-templates/>
  </fo:list-block>
</xsl:template>

<xsl:template match="list//list">
  <fo:list-block space-before="8pt"
                 provisional-distance-between-starts="3pc"
                 provisional-label-separation="1pc"
                 start-indent="3pc">
    <xsl:apply-templates/>
  </fo:list-block>
</xsl:template>

<xsl:template match="list/item">
  <fo:list-item space-before="6pt">
    <fo:list-item-label>
      <fo:block>
        <xsl:number count="item" format="1."/>
      </fo:block>
    </fo:list-item-label>
    <fo:list-item-body>
      <fo:block>
        <xsl:apply-templates/>
      </fo:block>
    </fo:list-item-body>
  </fo:list-item>
</xsl:template>

<xsl:template match="list//list/item" priority="1">
  <fo:list-item space-before="6pt">
    <fo:list-item-label>
      <fo:block>
        <xsl:number count="item" format="a."/>
      </fo:block>
    </fo:list-item-label>
    <fo:list-item-body>
      <fo:block>
        <xsl:apply-templates/>
      </fo:block>
    </fo:list-item-body>
  </fo:list-item>
</xsl:template>

<xsl:template match="list//list//list/item" priority="2">
  <fo:list-item space-before="6pt">
    <fo:list-item-label>
      <fo:block>
        <xsl:number count="item" format="i."/>
      </fo:block>
    </fo:list-item-label>
    <fo:list-item-body>
      <fo:block>
        <xsl:apply-templates/>
      </fo:block>
    </fo:list-item-body>
  </fo:list-item>
</xsl:template>

</xsl:stylesheet>