OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [PATCH] add "table caption" as a formal.title.placement option


Patch to allow "caption" as a keyword for table titles in
"formatl.title.placement", if you like.  Patch is against
version 1.69.1.

-Stephen


diff -X dtbl-dontdiff -uNr docbook-xsl-1.69.1.orig/common/titles.xsl docbook-xsl-1.69.1/common/titles.xsl
--- docbook-xsl-1.69.1.orig/common/titles.xsl	2005-06-06 04:46:27.000000000 -0400
+++ docbook-xsl-1.69.1/common/titles.xsl	2006-02-13 16:42:19.704530744 -0500
@@ -16,6 +16,48 @@
 
 <!-- ==================================================================== -->
 
+<doc:template name="get-placement" xmlns="">
+<refpurpose>Get the title placement for a specific object type.</refpurpose>
+
+<refdescription>
+<para>This template returns the title placement for the specified
+object by parsing the value of "formal.title.placement".</para>
+</refdescription>
+
+<refparameter>
+<variablelist>
+<varlistentry><term>object.type</term>
+<listitem>
+<para>The type of object for which the placement setting should be returned.
+Default: local-name(.)</para>
+</listitem>
+</varlistentry>
+</variablelist>
+</refparameter>
+
+<refreturn>
+<para>A string representing the desired placement of the object's
+      title</para>
+</refreturn>
+</doc:template>
+
+<xsl:template name="get-placement">
+  <xsl:param name="object.type" select="local-name(.)"/>
+  <xsl:variable name="param.placement"
+                select="substring-after(normalize-space($formal.title.placement),
+                                        concat($object.type, ' '))"/>
+
+  <xsl:choose>
+    <xsl:when test="contains($param.placement, ' ')">
+      <xsl:value-of select="substring-before($param.placement, ' ')"/>
+    </xsl:when>
+    <xsl:when test="$param.placement = ''">before</xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$param.placement"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 <!-- title markup -->
 
 <doc:mode mode="title.markup" xmlns="">
diff -X dtbl-dontdiff -uNr docbook-xsl-1.69.1.orig/html/formal.xsl docbook-xsl-1.69.1/html/formal.xsl
--- docbook-xsl-1.69.1.orig/html/formal.xsl	2004-04-11 18:41:29.000000000 -0400
+++ docbook-xsl-1.69.1/html/formal.xsl	2006-02-13 17:22:31.837830744 -0500
@@ -44,7 +44,9 @@
           <xsl:call-template name="table.longdesc"/>
         </xsl:if>
 
-        <xsl:call-template name="formal.object.heading"/>
+        <xsl:if test="$placement != 'caption'">
+          <xsl:call-template name="formal.object.heading"/>
+        </xsl:if>
       </xsl:otherwise>
     </xsl:choose>
   </div>
diff -X dtbl-dontdiff -uNr docbook-xsl-1.69.1.orig/html/table.xsl docbook-xsl-1.69.1/html/table.xsl
--- docbook-xsl-1.69.1.orig/html/table.xsl	2005-06-01 22:25:17.000000000 -0400
+++ docbook-xsl-1.69.1/html/table.xsl	2006-02-13 16:48:53.743627696 -0500
@@ -333,6 +333,25 @@
       </xsl:otherwise>
     </xsl:choose>
 
+    <xsl:variable name="placement">
+      <xsl:call-template name="get-placement">
+          <xsl:with-param name="object.type" select="'table'"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:if test="$placement = 'caption'">
+      <xsl:variable name="position">
+        <xsl:number count="tgroup"/>
+      </xsl:variable>
+      <xsl:if test="$position = 1">
+        <caption>
+          <xsl:apply-templates select=".." mode="object.title.markup">
+              <xsl:with-param name="allow-anchors" select="1"/>
+          </xsl:apply-templates>
+        </caption>
+      </xsl:if>
+    </xsl:if>
+
     <xsl:variable name="colgroup">
       <colgroup>
         <xsl:call-template name="generate.colgroup">
diff -X dtbl-dontdiff -uNr docbook-xsl-1.69.1.orig/params/formal.title.placement.xml docbook-xsl-1.69.1/params/formal.title.placement.xml
--- docbook-xsl-1.69.1.orig/params/formal.title.placement.xml	2005-06-16 02:59:46.000000000 -0400
+++ docbook-xsl-1.69.1/params/formal.title.placement.xml	2006-02-13 17:09:24.696494416 -0500
@@ -30,7 +30,11 @@
 <sgmltag>table</sgmltag>, and <sgmltag>procedure</sgmltag>)
 you can specify either the keyword
 <quote><literal>before</literal></quote> or
-<quote><literal>after</literal></quote>.</para>
+<quote><literal>after</literal></quote>.
+The keyword
+<quote><literal>caption</literal></quote>
+is also accepted
+for tables rendered in html.</para>
 
 </refsect1>
 </refentry>


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]