]> granicus.if.org Git - docbook-dsssl/commitdiff
Changed handling of reference auto-labeling such that reference
authorMichael Smith <xmldoc@users.sourceforge.net>
Sat, 14 Jul 2007 19:58:59 +0000 (19:58 +0000)
committerMichael Smith <xmldoc@users.sourceforge.net>
Sat, 14 Jul 2007 19:58:59 +0000 (19:58 +0000)
(when it appears at the component level) is now affected by the
label.from.part param, just as preface, chapter, and appendix.

xsl/common/labels.xsl
xsl/params/label.from.part.xml

index 98050d01215336d1897f6d40cb5d258ac630486f..38b123a3561c590def7c30d1e4b2be09e0034ea4 100644 (file)
@@ -193,12 +193,31 @@ element label.</para>
       <xsl:value-of select="@label"/>
     </xsl:when>
     <xsl:when test="string($reference.autolabel) != 0">
+      <xsl:if test="$component.label.includes.part.label != 0 and
+                      ancestor::part">
+        <xsl:variable name="part.label">
+          <xsl:apply-templates select="ancestor::part" 
+                               mode="label.markup"/>
+        </xsl:variable>
+        <xsl:if test="$part.label != ''">
+          <xsl:value-of select="$part.label"/>
+          <xsl:apply-templates select="ancestor::part" 
+                               mode="intralabel.punctuation"/>
+        </xsl:if>
+      </xsl:if>
       <xsl:variable name="format">
         <xsl:call-template name="autolabel.format">
           <xsl:with-param name="format" select="$reference.autolabel"/>
         </xsl:call-template>
       </xsl:variable>
-      <xsl:number from="book" count="reference" format="{$format}" level="any"/>
+      <xsl:choose>
+        <xsl:when test="$label.from.part != 0 and ancestor::part">
+          <xsl:number from="part" count="reference" format="{$format}" level="any"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:number from="book" count="reference" format="{$format}" level="any"/>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:when>
   </xsl:choose>
 </xsl:template>
index 5ff9db7a6c91479a0bb403aec63e7200d54b38ff..3c6d0253ebec6db774297c7e68ea7f0e173728d1 100644 (file)
@@ -10,7 +10,7 @@
 </refmeta>
 <refnamediv>
 <refname>label.from.part</refname>
-<refpurpose>Renumber chapters in each part?</refpurpose>
+<refpurpose>Renumber components in each part?</refpurpose>
 </refnamediv>
 
 <refsynopsisdiv>
 
 <refsection><info><title>Description</title></info>
 
-<para>If <parameter>label.from.part</parameter> is non-zero, components
-(<tag>chapter</tag>s, <tag>appendixe</tag>s, etc.)
-will be numbered from 1 in each <tag>part</tag>. Otherwise,
-they will be numbered monotonically throughout each
-<tag>book</tag>.
-</para>
+<para>If <parameter>label.from.part</parameter> is non-zero, then
+  numbering of components — <tag>preface</tag>,
+  <tag>chapter</tag>, <tag>appendix</tag>, and
+  <tag>reference</tag> (when <tag>reference</tag> occurs at the
+  component level) — is re-started within each
+  <tag>part</tag>.</para>
+<para>If <parameter>label.from.part</parameter> is zero (the
+  default), numbering of components is <emphasis>not</emphasis>
+  re-started within each <tag>part</tag>; instead, components are
+  numbered sequentially throughout each <tag>book</tag>,
+  regardless of whether or not they occur within <tag>part</tag>
+  instances.</para>
 
 </refsection>
 </refentry>