]> granicus.if.org Git - docbook-dsssl/commitdiff
Fixed thinko
authorNorman Walsh <ndw@nwalsh.com>
Wed, 17 Jul 2002 11:04:16 +0000 (11:04 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Wed, 17 Jul 2002 11:04:16 +0000 (11:04 +0000)
xsl/common/labels.xsl

index 87ace73e7fbc96678ad3556db57a9b97aa0f0a3c..a3385a1eaae005f814162bdd58924443f70cd923 100644 (file)
@@ -488,8 +488,40 @@ element label.</para>
   </xsl:if>
 </xsl:template>
 
-<xsl:template match="figure|table|example|equation|procedure"
-              mode="label.markup">
+<xsl:template match="figure|table|example|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: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 format="1" from="chapter|appendix" level="any"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:number 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
                         |ancestor::appendix