+
+<!-- Arrange for ordered list numbers to be in parentheses instead of just
+followed by a dot, which I don't like. Unfortunately, this styling is
+output-specific, so we have to do it separately for FO and HTML output. -->
+
+<xsl:param name="orderedlist.label.width" select="'2.0em'"></xsl:param>
+
+<xsl:attribute-set name="orderedlist.label.properties">
+ <xsl:attribute name="text-align">left</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:template match="orderedlist/listitem" mode="item-number">
+ <xsl:variable name="numeration">
+ <xsl:call-template name="list.numeration">
+ <xsl:with-param name="node" select="parent::orderedlist"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="type">
+ <xsl:choose>
+ <xsl:when test="$numeration='arabic'">(1)</xsl:when>
+ <xsl:when test="$numeration='loweralpha'">(a)</xsl:when>
+ <xsl:when test="$numeration='lowerroman'">(i)</xsl:when>
+ <xsl:when test="$numeration='upperalpha'">(A)</xsl:when>
+ <xsl:when test="$numeration='upperroman'">(I)</xsl:when>
+ <!-- What!? This should never happen -->
+ <xsl:otherwise>
+ <xsl:message>
+ <xsl:text>Unexpected numeration: </xsl:text>
+ <xsl:value-of select="$numeration"/>
+ </xsl:message>
+ <xsl:value-of select="1."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="item-number">
+ <xsl:call-template name="orderedlist-item-number"/>
+ </xsl:variable>
+
+ <xsl:if test="parent::orderedlist/@inheritnum='inherit'
+ and ancestor::listitem[parent::orderedlist]">
+ <xsl:apply-templates select="ancestor::listitem[parent::orderedlist][1]"
+ mode="item-number"/>
+ </xsl:if>
+
+ <xsl:number value="$item-number" format="{$type}"/>
+</xsl:template>
+