]> granicus.if.org Git - docbook-dsssl/commitdiff
Support xref to refnamediv and all elements with titles (at least when they have...
authorNorman Walsh <ndw@nwalsh.com>
Sun, 12 May 2002 11:21:41 +0000 (11:21 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sun, 12 May 2002 11:21:41 +0000 (11:21 +0000)
xsl/html/xref.xsl

index 04257c12b3de4e9c2a30e44b6ff1e0c0e0227f5f..ff3e649ff8ec7254bd2df81f420954f4d427a45c 100644 (file)
           <xsl:apply-templates select="$target" mode="xref-to-prefix"/>
 
           <a href="{$href}">
-            <xsl:attribute name="title">
-              <xsl:apply-templates select="$target" mode="xref-title"/>
-            </xsl:attribute>
+            <xsl:if test="$target/title or $target/*/title">
+              <xsl:attribute name="title">
+                <xsl:apply-templates select="$target" mode="xref-title"/>
+              </xsl:attribute>
+            </xsl:if>
             <xsl:apply-templates select="$target" mode="xref-to"/>
           </a>
 
   <xsl:text>???</xsl:text>
 </xsl:template>
 
+<xsl:template match="title" mode="xref-to">
+  <!-- if you xref to a title, xref to the parent... -->
+  <xsl:choose>
+    <!-- FIXME: how reliable is this? -->
+    <xsl:when test="contains(local-name(parent::*), 'info')">
+      <xsl:apply-templates select="parent::*[2]" mode="xref-to"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates select="parent::*" mode="xref-to"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="abstract|article|authorblurb|bibliodiv|bibliomset
+                     |biblioset|blockquote|calloutlist|caution|colophon
+                     |constraintdef|formalpara|glossdiv|important|indexdiv
+                     |itemizedlist|legalnotice|lot|msg|msgexplan|msgmain
+                     |msgrel|msgset|msgsub|note|orderedlist|partintro
+                     |productionset|qandadiv|refsynopsisdiv|segmentedlist
+                     |set|setindex|sidebar|tip|toc|variablelist|warning"
+              mode="xref-to">
+  <!-- catch-all for things with (possibly optional) titles -->
+  <xsl:apply-templates select="." mode="object.xref.markup"/>
+</xsl:template>
+
 <xsl:template match="author|editor|othercredit|personname" mode="xref-to">
   <xsl:call-template name="person.name"/>
 </xsl:template>
   <xsl:apply-templates select="refmeta/manvolnum"/>
 </xsl:template>
 
+<xsl:template match="refnamediv" mode="xref-to">
+  <xsl:apply-templates select="refname[1]" mode="xref-to"/>
+</xsl:template>
+
+<xsl:template match="refname" mode="xref-to">
+  <xsl:apply-templates mode="xref-to"/>
+</xsl:template>
+
 <xsl:template match="step" mode="xref-to">
   <xsl:call-template name="gentext">
     <xsl:with-param name="key" select="'Step'"/>