]> granicus.if.org Git - docbook-dsssl/commitdiff
Gave procedure its own label.markup template because it
authorBob Stayton <bobs@sagehill.net>
Thu, 30 Jun 2005 04:29:06 +0000 (04:29 +0000)
committerBob Stayton <bobs@sagehill.net>
Thu, 30 Jun 2005 04:29:06 +0000 (04:29 +0000)
should not count procedures without  title.

xsl/common/labels.xsl

index ae9910803f95054ce562c12d4f86f74bd1c61ddd..597c208a177d817b3a88b57d199976793b63c97b 100644 (file)
@@ -549,7 +549,7 @@ element label.</para>
   </xsl:if>
 </xsl:template>
 
-<xsl:template match="figure|table|example|procedure" mode="label.markup">
+<xsl:template match="figure|table|example" mode="label.markup">
   <xsl:variable name="pchap"
                 select="ancestor::chapter
                         |ancestor::appendix
@@ -565,10 +565,6 @@ element label.</para>
     <xsl:when test="@label">
       <xsl:value-of select="@label"/>
     </xsl:when>
-    <xsl:when test="local-name() = 'procedure' and
-                    $formal.procedures = 0">
-      <!-- No label -->
-    </xsl:when>
     <xsl:otherwise>
       <xsl:choose>
         <xsl:when test="count($pchap)>0">
@@ -586,6 +582,44 @@ element label.</para>
   </xsl:choose>
 </xsl:template>
 
+<xsl:template match="procedure" mode="label.markup">
+  <xsl:variable name="pchap"
+                select="ancestor::chapter
+                        |ancestor::appendix
+                        |ancestor::article[ancestor::book]"/>
+
+  <xsl:variable name="prefix">
+    <xsl:if test="count($pchap) &gt; 0">
+      <xsl:apply-templates select="$pchap" mode="label.markup"/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="@label">
+      <xsl:value-of select="@label"/>
+    </xsl:when>
+    <xsl:when test="$formal.procedures = 0">
+      <!-- No label -->
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:choose>
+        <xsl:when test="count($pchap)>0">
+          <xsl:if test="$prefix != ''">
+            <xsl:apply-templates select="$pchap" mode="label.markup"/>
+            <xsl:apply-templates select="$pchap" mode="intralabel.punctuation"/>
+          </xsl:if>
+          <xsl:number count="procedure[title]" format="1" 
+                     from="chapter|appendix" level="any"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:number count="procedure[title]" format="1" 
+                     from="book|article" level="any"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 <xsl:template match="equation" mode="label.markup">
   <xsl:variable name="pchap"
                 select="ancestor::chapter