]> granicus.if.org Git - docbook-dsssl/commitdiff
Improve QandA formatting; make question bold if defaultlabel=none (FR #419315)
authorNorman Walsh <ndw@nwalsh.com>
Sun, 8 Jul 2001 16:41:39 +0000 (16:41 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sun, 8 Jul 2001 16:41:39 +0000 (16:41 +0000)
xsl/fo/qandaset.xsl
xsl/html/qandaset.xsl

index 99aa593f1d52666f3c85d1532c941a9f855b9ffa..65be059b6c9ccca9c3512a8336acec6e0b4fdeff 100644 (file)
 
 <xsl:template match="question">
   <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
+
   <xsl:variable name="entry.id">
     <xsl:call-template name="object.id">
       <xsl:with-param name="object" select="parent::*"/>
     </xsl:call-template>
   </xsl:variable>
 
+  <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>
+
   <fo:list-item id="{$entry.id}" xsl:use-attribute-sets="list.item.spacing">
     <fo:list-item-label id="{$id}" end-indent="label-end()">
-      <fo:block>
-        <xsl:call-template name="question.answer.label"/>
-      </fo:block>
+      <xsl:choose>
+        <xsl:when test="$deflabel = 'none'">
+          <fo:block/>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:block>
+            <xsl:apply-templates select="." mode="label.markup"/>
+          </fo:block>
+        </xsl:otherwise>
+      </xsl:choose>
     </fo:list-item-label>
     <fo:list-item-body start-indent="body-start()">
-      <xsl:apply-templates/>
+      <xsl:choose>
+        <xsl:when test="$deflabel = 'none'">
+          <fo:block font-weight="bold">
+            <xsl:apply-templates select="*[local-name(.)!='label']"/>
+          </fo:block>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates select="*[local-name(.)!='label']"/>
+        </xsl:otherwise>
+      </xsl:choose>
     </fo:list-item-body>
   </fo:list-item>
 </xsl:template>
     </xsl:call-template>
   </xsl:variable>
 
+  <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>
+
   <fo:list-item xsl:use-attribute-sets="list.item.spacing">
     <fo:list-item-label id="{$id}" end-indent="label-end()">
-      <fo:block>
-        <xsl:call-template name="question.answer.label"/>
-      </fo:block>
+      <xsl:choose>
+        <xsl:when test="$deflabel = 'none'">
+          <fo:block/>
+        </xsl:when>
+        <xsl:otherwise>
+          <fo:block>
+            <xsl:apply-templates select="." mode="label.markup"/>
+          </fo:block>
+        </xsl:otherwise>
+      </xsl:choose>
     </fo:list-item-label>
     <fo:list-item-body start-indent="body-start()">
-      <xsl:apply-templates/>
+      <xsl:apply-templates select="*[local-name(.)!='label']"/>
     </fo:list-item-body>
   </fo:list-item>
 </xsl:template>
index 84c318a13e4c124549f10269f3e204e6c4b13489..0a58d422ec11a80cc76af08fdb2abecacde5febf 100644 (file)
     <xsl:call-template name="object.id"/>
   </xsl:variable>
 
+  <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>
+
   <div class="{name(.)}">
     <p>
       <xsl:if test="../@id">
         </a>
       </xsl:if>
       <a name="{$id}"/>
-      <b>
-        <xsl:apply-templates select="." mode="label.markup"/>
-        <xsl:text> </xsl:text>
-      </b>
-      <xsl:apply-templates select="$firstch" mode="no.wrapper.mode"/>
+
+      <xsl:choose>
+        <xsl:when test="$deflabel = 'none'">
+          <b>
+            <xsl:apply-templates select="$firstch" mode="no.wrapper.mode"/>
+          </b>
+        </xsl:when>
+        <xsl:otherwise>
+          <b>
+            <xsl:apply-templates select="." mode="label.markup"/>
+            <xsl:text> </xsl:text>
+          </b>
+          <xsl:apply-templates select="$firstch" mode="no.wrapper.mode"/>
+        </xsl:otherwise>
+      </xsl:choose>
     </p>
     <xsl:apply-templates select="$restch"/>
   </div>