]> granicus.if.org Git - docbook-dsssl/commitdiff
Added template for question in object.xref.markup mode
authorBob Stayton <bobs@sagehill.net>
Thu, 31 Jul 2003 05:04:35 +0000 (05:04 +0000)
committerBob Stayton <bobs@sagehill.net>
Thu, 31 Jul 2003 05:04:35 +0000 (05:04 +0000)
to handle case of defaultlabel = qanda.

xsl/common/gentext.xsl

index f7f782653160d62109a834dca64f3d9c6095acba..ea8317032965cd8b25d61f7197774996222c6dfc 100644 (file)
   </xsl:choose>
 </xsl:template>
 
+<xsl:template match="question" mode="object.xref.markup">
+  <xsl:param name="purpose"/>
+  <xsl:param name="xrefstyle"/>
+  <xsl:param name="referrer"/>
+
+  <xsl:variable name="deflabel">
+    <xsl:choose>
+      <xsl:when test="ancestor-or-self::*[@defaultlabel]">
+        <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
+                              /@defaultlabel"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$qanda.defaultlabel"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="template">
+    <xsl:choose>
+      <!-- This avoids double Q: Q: in xref when defaultlabel=qanda -->
+      <xsl:when test="$deflabel = 'qanda' and not(label)">%n</xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates select="." mode="object.xref.template">
+          <xsl:with-param name="purpose" select="$purpose"/>
+          <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+          <xsl:with-param name="referrer" select="$referrer"/>
+        </xsl:apply-templates>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:call-template name="substitute-markup">
+    <xsl:with-param name="purpose" select="$purpose"/>
+    <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
+    <xsl:with-param name="referrer" select="$referrer"/>
+    <xsl:with-param name="template" select="$template"/>
+  </xsl:call-template>
+</xsl:template>
+
 <!-- ============================================================ -->
 
 <xsl:template name="substitute-markup">