</xsl:if>
</xsl:template>
+<!-- ====================================================================== -->
+<!-- Procedure Step Numeration -->
+
+<xsl:param name="procedure.step.numeration.formats" select="'1aiAI'"/>
+
+<xsl:template name="procedure.step.numeration">
+ <xsl:param name="context" select="."/>
+ <xsl:variable name="format.length"
+ select="string-length($procedure.step.numeration.formats)"/>
+ <xsl:choose>
+ <xsl:when test="local-name($context) = 'substeps'">
+ <xsl:variable name="ssdepth"
+ select="count($context/ancestor::substeps)"/>
+ <xsl:variable name="sstype" select="($ssdepth mod $format.length)+2"/>
+ <xsl:choose>
+ <xsl:when test="$sstype > $format.length">
+ <xsl:value-of select="substring($procedure.step.numeration.formats,1,1)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="substring($procedure.step.numeration.formats,$sstype,1)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:when test="local-name($context) = 'step'">
+ <xsl:variable name="sdepth"
+ select="count($context/ancestor::substeps)"/>
+ <xsl:variable name="stype" select="($sdepth mod $format.length)+1"/>
+ <xsl:value-of select="substring($procedure.step.numeration.formats,$stype,1)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+ <xsl:text>Unexpected context in procedure.step.numeration: </xsl:text>
+ <xsl:value-of select="local-name($context)"/>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:template match="step" mode="number">
+ <xsl:param name="rest" select="''"/>
+ <xsl:param name="recursive" select="1"/>
+ <xsl:variable name="format">
+ <xsl:call-template name="procedure.step.numeration"/>
+ </xsl:variable>
+ <xsl:variable name="num">
+ <xsl:number count="step" format="{$format}"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$recursive != 0 and ancestor::step">
+ <xsl:apply-templates select="ancestor::step[1]" mode="number">
+ <xsl:with-param name="rest" select="concat('.', $num, $rest)"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat($num, $rest)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
<!-- ====================================================================== -->
</xsl:stylesheet>
</xsl:choose>
</xsl:template>
+<xsl:template match="procedure" mode="object.title.template">
+ <xsl:choose>
+ <xsl:when test="$formal.procedures != 0">
+ <xsl:call-template name="gentext.template">
+ <xsl:with-param name="context" select="'title'"/>
+ <xsl:with-param name="name" select="'procedure.formal'"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="gentext.template">
+ <xsl:with-param name="context" select="'title'"/>
+ <xsl:with-param name="name" select="local-name(.)"/>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
<xsl:template match="article/appendix"
mode="object.title.template">
<!-- FIXME: HACK HACK HACK! -->
</xsl:if>
</xsl:template>
-<xsl:template match="figure|table|example|equation" mode="label.markup">
+<xsl:template match="figure|table|example|equation|procedure"
+ mode="label.markup">
<xsl:variable name="pchap"
select="ancestor::chapter|ancestor::appendix"/>
</xsl:apply-templates>
</xsl:template>
+<xsl:template match="procedure" mode="title.markup">
+ <xsl:param name="allow-anchors" select="'0'"/>
+ <xsl:apply-templates select="title" mode="title.markup">
+ <xsl:with-param name="allow-anchors" select="$allow-anchors"/>
+ </xsl:apply-templates>
+</xsl:template>
+
<xsl:template match="abstract" mode="title.markup">
<xsl:param name="allow-anchors" select="'0'"/>
<xsl:choose>
<!-- ==================================================================== -->
<xsl:template match="procedure">
+ <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
<xsl:variable name="title" select="title"/>
<xsl:variable name="preamble"
select="*[not(self::step or self::title)]"/>
<xsl:variable name="steps" select="step"/>
- <fo:block space-before.optimum="1em"
+ <fo:block id="{$id}"
+ space-before.optimum="1em"
space-before.minimum="0.8em"
space-before.maximum="1.2em">
<xsl:if test="./title">
</xsl:template>
<xsl:template match="step">
- <xsl:variable name="depth" select="count(ancestor::substeps)"/>
- <xsl:variable name="type" select="$depth mod 5"/>
-
+ <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
<fo:list-item>
<fo:list-item-label end-indent="label-end()">
- <fo:block>
- <xsl:choose>
- <xsl:when test="$depth = 0">
- <xsl:number count="step" format="1."/>
- </xsl:when>
- <xsl:when test="$type = 1">
- <xsl:number count="step" format="a."/>
- </xsl:when>
- <xsl:when test="$type = 2">
- <xsl:number count="step" format="i."/>
- </xsl:when>
- <xsl:when test="$type = 3">
- <xsl:number count="step" format="A."/>
- </xsl:when>
- <xsl:when test="$type = 4">
- <xsl:number count="step" format="I."/>
- </xsl:when>
- <xsl:when test="$type = 0">
- <xsl:number count="step" format="1."/>
- </xsl:when>
- </xsl:choose>
+ <fo:block id="{$id}">
+ <xsl:apply-templates select="." mode="number">
+ <xsl:with-param name="recursive" select="0"/>
+ </xsl:apply-templates>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
</refdescription>
</doc:param>
+<!-- ==================================================================== -->
+<xsl:param name="formal.procedures" select="1" doc:type='boolean'/>
+
+<doc:param name="formal.procedures" xmlns="">
+<refpurpose>Selects formal or informal procedures</refpurpose>
+<refdescription>
+<para>Formal procedures are numbered and always hav a title.
+</para>
+</refdescription>
+</doc:param>
+
</xsl:stylesheet>
<xsl:apply-templates select="." mode="object.xref.markup"/>
</xsl:template>
+<xsl:template match="procedure" mode="xref-to">
+ <xsl:apply-templates select="." mode="object.xref.markup"/>
+</xsl:template>
+
<xsl:template match="cmdsynopsis" mode="xref-to">
<xsl:apply-templates select="(.//command)[1]" mode="xref"/>
</xsl:template>
<xsl:apply-templates select="." mode="object.xref.markup"/>
</xsl:template>
+<xsl:template match="step" mode="xref-to">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key" select="'Step'"/>
+ </xsl:call-template>
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates select="." mode="number"/>
+</xsl:template>
+
<xsl:template match="co" mode="xref-to">
<xsl:apply-templates select="." mode="callout-bug"/>
</xsl:template>
<!-- ==================================================================== -->
<xsl:template match="procedure">
- <xsl:variable name="id">
- <xsl:call-template name="object.id"/>
- </xsl:variable>
<div class="{name(.)}">
- <a name="{$id}"/>
- <xsl:if test="title">
- <xsl:apply-templates select="title" mode="procedure.title.mode"/>
+ <xsl:if test="title or $formal.procedures != 0">
+ <xsl:call-template name="formal.object.heading"/>
</xsl:if>
- <xsl:apply-templates select="*[local-name()!='step']"/>
- <ol><xsl:apply-templates select="step"/></ol>
+ <xsl:apply-templates select="*[local-name()!='step']"/>
+ <ol>
+ <xsl:attribute name="type">
+ <xsl:value-of select="substring($procedure.step.numeration.formats,1,1)"/>
+ </xsl:attribute>
+ <xsl:apply-templates select="step"/>
+ </ol>
</div>
</xsl:template>
</xsl:template>
<xsl:template match="substeps">
- <xsl:variable name="depth" select="count(ancestor::substeps)"/>
- <xsl:variable name="type" select="$depth mod 5"/>
<xsl:variable name="numeration">
- <xsl:choose>
- <xsl:when test="$type = 0">a</xsl:when>
- <xsl:when test="$type = 1">i</xsl:when>
- <xsl:when test="$type = 2">A</xsl:when>
- <xsl:when test="$type = 3">I</xsl:when>
- <xsl:when test="$type = 4">1</xsl:when>
- </xsl:choose>
+ <xsl:call-template name="procedure.step.numeration"/>
</xsl:variable>
<ol type="{$numeration}">
</refdescription>
</doc:param>
+<!-- ==================================================================== -->
+<xsl:param name="formal.procedures" select="1" doc:type='boolean'/>
+
+<doc:param name="formal.procedures" xmlns="">
+<refpurpose>Selects formal or informal procedures</refpurpose>
+<refdescription>
+<para>Formal procedures are numbered and always hav a title.
+</para>
+</refdescription>
+</doc:param>
</xsl:stylesheet>
<xsl:apply-templates select="." mode="object.xref.markup"/>
</xsl:template>
+<xsl:template match="procedure" mode="xref-to">
+ <xsl:apply-templates select="." mode="object.xref.markup"/>
+</xsl:template>
+
<xsl:template match="cmdsynopsis" mode="xref-to">
<xsl:apply-templates select="(.//command)[1]" mode="xref"/>
</xsl:template>
<xsl:apply-templates select="." mode="object.xref.markup"/>
</xsl:template>
+<xsl:template match="step" mode="xref-to">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key" select="'Step'"/>
+ </xsl:call-template>
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates select="." mode="number"/>
+</xsl:template>
+
<xsl:template match="co" mode="xref-to">
<xsl:apply-templates select="." mode="callout-bug"/>
</xsl:template>
<xsl:value-of select="$title"/>
</xsl:template>
+<xsl:template match="step" mode="xref-title">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key" select="'Step'"/>
+ </xsl:call-template>
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates select="." mode="number"/>
+</xsl:template>
+
<xsl:template match="co" mode="xref-title">
<xsl:variable name="title">
<xsl:apply-templates select="." mode="callout-bug"/>