]> granicus.if.org Git - docbook-dsssl/commitdiff
Bug #463033: allow xref to list items (in orderedlists) and varlistentrys
authorNorman Walsh <ndw@nwalsh.com>
Sat, 22 Sep 2001 14:16:38 +0000 (14:16 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sat, 22 Sep 2001 14:16:38 +0000 (14:16 +0000)
xsl/common/gentext.xsl
xsl/common/labels.xsl
xsl/fo/xref.xsl
xsl/html/xref.xsl

index 5506216c26192ffb002d85a35d2c2e042361f273..1a72f4ea98342ce593e8d87aa6f358fe32e53c6e 100644 (file)
   </xsl:call-template>
 </xsl:template>
 
-<xsl:template match="section|simplesect
-                     |sect1|sect2|sect3|sect4|sect5
-                     |refsect1|refsect2|refsect3
-                     |bridgehead"
-              mode="object.xref.markup">
-  <xsl:variable name="template">
-    <xsl:apply-templates select="." mode="object.xref.template"/>
-  </xsl:variable>
-
-<!--
-  <xsl:message>
-    <xsl:text>object.xref.markup: </xsl:text>
-    <xsl:value-of select="local-name(.)"/>
-    <xsl:text>: </xsl:text>
-    <xsl:value-of select="$template"/>
-  </xsl:message>
--->
-
-  <xsl:call-template name="substitute-markup">
-    <xsl:with-param name="template" select="$template"/>
-  </xsl:call-template>
+<xsl:template match="listitem" mode="object.xref.markup">
+  <xsl:choose>
+    <xsl:when test="parent::orderedlist">
+      <xsl:variable name="template">
+        <xsl:apply-templates select="." mode="object.xref.template"/>
+      </xsl:variable>
+      <xsl:call-template name="substitute-markup">
+        <xsl:with-param name="template" select="$template"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:message>
+        <xsl:text>Xref is only supported to listitems in an</xsl:text>
+        <xsl:text> orderedlist: </xsl:text>
+        <xsl:value-of select="@id"/>
+      </xsl:message>
+      <xsl:text>???</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
 <!-- ============================================================ -->
index 0d633b6e6da2baea0633906f8a292f8688085966..a771a6585572599ddf9bda947d35855b876073f6 100644 (file)
@@ -494,6 +494,34 @@ element label.</para>
   </xsl:choose>
 </xsl:template>
 
+<xsl:template match="orderedlist/listitem" mode="label.markup">
+  <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:number count="listitem" format="{$type}"/>
+</xsl:template>
+
 <xsl:template match="abstract" mode="label.markup">
   <!-- nop -->
 </xsl:template>
index b9e3b956d4f02d688efdfa966c512dea1cbb58a5..581413d21d10b0565852e618f7f718e51b5064f9 100644 (file)
   <xsl:apply-templates select="." mode="object.xref.markup"/>
 </xsl:template>
 
+<xsl:template match="listitem" mode="xref-to">
+  <xsl:apply-templates select="." mode="object.xref.markup"/>
+</xsl:template>
+
 <xsl:template match="section|simplesect
                      |sect1|sect2|sect3|sect4|sect5
                      |refsect1|refsect2|refsect3" mode="xref-to">
   <xsl:apply-templates select="." mode="number"/>
 </xsl:template>
 
+<xsl:template match="varlistentry" mode="xref-to">
+  <xsl:apply-templates select="term[1]" mode="xref-to"/>
+</xsl:template>
+
+<xsl:template match="varlistentry/term" mode="xref-to">
+  <!-- to avoid the comma that will be generated if there are several terms -->
+  <xsl:apply-templates/>
+</xsl:template>
+
 <xsl:template match="co" mode="xref-to">
   <xsl:apply-templates select="." mode="callout-bug"/>
 </xsl:template>
index a074bb82710f7f1ef1df138fa5ad92e45ca3f900..3973ba7eee84ef7a3a290d6fa57f6daafefc7edc 100644 (file)
   <xsl:apply-templates select="." mode="object.xref.markup"/>
 </xsl:template>
 
+<xsl:template match="listitem" mode="xref-to">
+  <xsl:apply-templates select="." mode="object.xref.markup"/>
+</xsl:template>
+
 <xsl:template match="section|simplesect
                      |sect1|sect2|sect3|sect4|sect5
                      |refsect1|refsect2|refsect3" mode="xref-to">
   <xsl:apply-templates select="." mode="number"/>
 </xsl:template>
 
+<xsl:template match="varlistentry" mode="xref-to">
+  <xsl:apply-templates select="term[1]" mode="xref-to"/>
+</xsl:template>
+
+<xsl:template match="varlistentry/term" mode="xref-to">
+  <!-- to avoid the comma that will be generated if there are several terms -->
+  <xsl:apply-templates/>
+</xsl:template>
+
 <xsl:template match="co" mode="xref-to">
   <xsl:apply-templates select="." mode="callout-bug"/>
 </xsl:template>