]> granicus.if.org Git - docbook-dsssl/commitdiff
Fixed handling of table footnotes.
authorMichael Smith <xmldoc@users.sourceforge.net>
Thu, 23 Mar 2006 03:02:10 +0000 (03:02 +0000)
committerMichael Smith <xmldoc@users.sourceforge.net>
Thu, 23 Mar 2006 03:02:10 +0000 (03:02 +0000)
With this checkin, the table support in the manpages stylesheet is
now basically feature complete. So this change closes request
#619532, "No support for tables" -- the oldest currently open
manpages feature request, submitted by Ben Secrest (blsecres) on
2002-10-07. Congratulations to me [patting myself on the back].

xsl/manpages/block.xsl
xsl/manpages/docbook.xsl
xsl/manpages/table.xsl

index d8729a69f6c5dd781d530e05dba2bd73bdc5b879..6cfef09832c3f2fef3959ef9f96df0febeda97ef 100644 (file)
@@ -39,7 +39,9 @@
 </xsl:template>
 
 <xsl:template match="para">
-  <xsl:text>.PP&#10;</xsl:text>
+  <xsl:if test="not(ancestor::footnote[ancestor::table])">
+    <xsl:text>.PP&#10;</xsl:text>
+  </xsl:if>
   <xsl:call-template name="mixed-block"/>
   <xsl:text>&#10;</xsl:text>
 </xsl:template>
index 381d91e294dc3323291374493697e8bcbf0730c7..dfd2b35377bcc8917b748546b1fcb317d98daee3 100644 (file)
@@ -46,6 +46,7 @@
   <xsl:param name="man.funcsynopsisinfo.font">B</xsl:param>
   <xsl:param name="man.table.headings.font">B</xsl:param>
   <xsl:param name="man.table.title.font">B</xsl:param>
+  <xsl:param name="man.table.footnotes.separator.line">----</xsl:param>
 
 <!-- ==================================================================== -->
 
index d27ffe500cb58ca5b54b5168649fa7fef240b700..9cf5b21dcb3cf53c1cfc98dcf81dd4b3b232837c 100644 (file)
       <xsl:value-of select="$man.table.title.font"/>
       <xsl:text> </xsl:text>
       <xsl:if test="self::htmltable">
-      <xsl:for-each select="ancestor-or-self::*">
-        <xsl:message><xsl:value-of select="@*"/></xsl:message>
-      </xsl:for-each>
     </xsl:if>
       <xsl:if test="parent::td|self::htmltable[@parent = 'td']">
         <xsl:text>*[nested&#160;table]</xsl:text>
           align="{@align}">
       <xsl:choose>
         <xsl:when test=".//tr">
-          <xsl:message>Warn: Extracted a nested table. (No nesting support in tbl(1).)</xsl:message>
+          <xsl:message
+              >Warn: Extracted a nested table. [tbl(1) does not support nesting]</xsl:message>
           <xsl:text>[nested&#160;table]*&#10;</xsl:text>
         </xsl:when>
         <xsl:otherwise>
     </xsl:if>
   </xsl:template>
 
-  <!-- * Not sure what if anything to do with colgroup -->
-  <xsl:template match="colgroup"/>
-  <xsl:template match="col"/>
+  <!-- * ============================================================== -->
+  <!-- *    Handle table footnotes                                      -->
+  <!-- * ============================================================== -->
+  <xsl:template match="footnote" mode="table.footnote.mode">
+    <xsl:variable name="footnotes" select=".//footnote"/>
+    <xsl:variable name="table.footnotes"
+                  select=".//tgroup//footnote"/>
+    <xsl:value-of select="$man.table.footnotes.separator.line"/>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:text>.br&#10;</xsl:text>
+    <xsl:apply-templates select="*[1]" mode="footnote.body.number"/>
+    <xsl:apply-templates select="*[position() &gt; 1]"/>
+  </xsl:template>
 
-  <!-- * The following templates are needed for dealing with -->
-  <!-- * table-footnote markup generated by the HTML stylesheets. -->
-  <xsl:template match="div">
-    <xsl:apply-templates/>
+  <!-- * The following template for footnote.body.number mode was just -->
+  <!-- * lifted from the HTML stylesheets with some minor adjustments -->
+  <xsl:template match="*"  mode="footnote.body.number">
+    <xsl:variable name="name">
+      <xsl:text>ftn.</xsl:text>
+      <xsl:call-template name="object.id">
+        <xsl:with-param name="object" select="ancestor::footnote"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="href">
+      <xsl:text>#</xsl:text>
+      <xsl:call-template name="object.id">
+        <xsl:with-param name="object" select="ancestor::footnote"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="footnote.mark">
+      <xsl:text>[</xsl:text>
+      <xsl:apply-templates select="ancestor::footnote"
+                           mode="footnote.number"/>
+      <xsl:text>]&#10;</xsl:text>
+    </xsl:variable>
+    <xsl:variable name="html">
+      <xsl:apply-templates select="."/>
+    </xsl:variable>
+    <xsl:choose>
+      <xsl:when test="function-available('exsl:node-set')">
+        <xsl:variable name="html-nodes" select="exsl:node-set($html)"/>
+        <xsl:choose>
+          <xsl:when test="$html-nodes//p">
+            <xsl:apply-templates select="$html-nodes" mode="insert.html.p">
+              <xsl:with-param name="mark" select="$footnote.mark"/>
+            </xsl:apply-templates>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates select="$html-nodes" mode="insert.html.text">
+              <xsl:with-param name="mark" select="$footnote.mark"/>
+            </xsl:apply-templates>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="$html"/>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:template>
-  <xsl:template match="sup">
+
+  <!-- * The HTML stylesheets output <sup><a>...</a></sup> around -->
+  <!-- * footnote markers in tables -->
+  <xsl:template match="th/sup">
     <xsl:apply-templates/>
   </xsl:template>
   <xsl:template match="a">
     <xsl:apply-templates/>
   </xsl:template>
 
+  <!-- * ============================================================== -->
+  <!-- *    colgroup and col                                            -->
+  <!-- * ============================================================== -->
+  <!-- * Not sure what if anything to do with colgroup... -->
+  <xsl:template match="colgroup"/>
+  <xsl:template match="col"/>
+
 </xsl:stylesheet>