]> granicus.if.org Git - docbook-dsssl/commitdiff
Add utility template tabstyle to return the tabstyle from
authorBob Stayton <bobs@sagehill.net>
Mon, 8 Jan 2007 03:32:20 +0000 (03:32 +0000)
committerBob Stayton <bobs@sagehill.net>
Mon, 8 Jan 2007 03:32:20 +0000 (03:32 +0000)
any table element.

xsl/common/table.xsl

index 4599f02adab9297fd3ab3fbe6e55bcd84cda65c7..8fa6c8e62f01836dc8c6ec5a0e2b113be7f5eac4 100644 (file)
@@ -473,4 +473,31 @@ or 0 (the empty string)</para>
   </xsl:if>
 </xsl:template>
 
+<!-- Returns the table style for the context element -->
+<xsl:template name="tabstyle">
+  <xsl:param name="node" select="."/>
+
+  <xsl:variable name="tgroup" select="$node/tgroup[1] | 
+                                      $node/ancestor-or-self::tgroup[1]"/>
+
+  <xsl:variable name="table" 
+                select="($node/ancestor-or-self::table | 
+                         $node/ancestor-or-self::informaltable)[1]"/>
+
+  <xsl:variable name="tabstyle">
+    <xsl:choose>
+      <xsl:when test="$table/@tabstyle != ''">
+        <xsl:value-of select="normalize-space($table/@tabstyle)"/>
+      </xsl:when>
+      <xsl:when test="$tgroup/@tgroupstyle != ''">
+        <xsl:value-of select="normalize-space($tgroup/@tgroupstyle)"/>
+      </xsl:when>
+      <xsl:otherwise>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:value-of select="$tabstyle"/>
+</xsl:template>
+
 </xsl:stylesheet>