e6b6c1
diff -ruNp docbook-xsl-1.74.0.orig/html/docbook.xsl docbook-xsl-1.74.0/html/docbook.xsl
e6b6c1
--- docbook-xsl-1.74.0.orig/html/docbook.xsl	2008-06-01 23:36:39.000000000 +0200
e6b6c1
+++ docbook-xsl-1.74.0/html/docbook.xsl	2008-08-06 13:37:35.000000000 +0200
e6b6c1
@@ -26,6 +26,7 @@
e6b6c1
 <xsl:include href="../VERSION.xsl"/>
e6b6c1
 <xsl:include href="param.xsl"/>
e6b6c1
 <xsl:include href="../lib/lib.xsl"/>
e6b6c1
+<xsl:include href="../lib/dumpfragment.xsl"/>
e6b6c1
 <xsl:include href="../common/l10n.xsl"/>
e6b6c1
 <xsl:include href="../common/common.xsl"/>
e6b6c1
 <xsl:include href="../common/utility.xsl"/>
e6b6c1
@@ -44,6 +45,7 @@
e6b6c1
 <xsl:include href="graphics.xsl"/>
e6b6c1
 <xsl:include href="xref.xsl"/>
e6b6c1
 <xsl:include href="formal.xsl"/>
e6b6c1
+<xsl:include href="dtbl.xsl"/>
e6b6c1
 <xsl:include href="table.xsl"/>
e6b6c1
 <xsl:include href="htmltbl.xsl"/>
e6b6c1
 <xsl:include href="sections.xsl"/>
e6b6c1
diff -ruNp docbook-xsl-1.74.0.orig/html/dtbl.xsl docbook-xsl-1.74.0/html/dtbl.xsl
e6b6c1
--- docbook-xsl-1.74.0.orig/html/dtbl.xsl	1970-01-01 01:00:00.000000000 +0100
e6b6c1
+++ docbook-xsl-1.74.0/html/dtbl.xsl	2008-08-06 13:37:35.000000000 +0200
e6b6c1
@@ -0,0 +1,293 @@
e6b6c1
+
e6b6c1
+
e6b6c1
+                xmlns:exsl="http://exslt.org/common"
e6b6c1
+                xmlns:func="http://exslt.org/functions"
e6b6c1
+                xmlns:dtbl="http://docbook.sourceforge.net/dtbl"
e6b6c1
+                extension-element-prefixes="func"
e6b6c1
+                exclude-result-prefixes="exsl func dtbl"
e6b6c1
+                version="1.0">
e6b6c1
+
e6b6c1
+<func:function name="dtbl:convertLength">
e6b6c1
+  <xsl:param name="arbitrary.length"/>
e6b6c1
+
e6b6c1
+  <xsl:variable name="pixels.per.inch" select="96"/>
e6b6c1
+
e6b6c1
+  
e6b6c1
+                select="translate($arbitrary.length, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ', '')"/>
e6b6c1
+
e6b6c1
+  
e6b6c1
+                select="translate($arbitrary.length,'+-0123456789. ', '')"/>
e6b6c1
+
e6b6c1
+  <xsl:variable name="scaled.length">
e6b6c1
+    <xsl:choose>
e6b6c1
+      <xsl:when test="$units='in'">
e6b6c1
+        <xsl:value-of select="$unscaled.length * $pixels.per.inch"/>
e6b6c1
+      </xsl:when>
e6b6c1
+      <xsl:when test="$units='cm'">
e6b6c1
+        <xsl:value-of select="$unscaled.length * ($pixels.per.inch div 2.54)"/>
e6b6c1
+      </xsl:when>
e6b6c1
+      <xsl:when test="$units='mm'">
e6b6c1
+        <xsl:value-of select="$unscaled.length * ($pixels.per.inch div 25.4)"/>
e6b6c1
+      </xsl:when>
e6b6c1
+      <xsl:when test="$units='pc'">
e6b6c1
+        <xsl:value-of select="$unscaled.length * (($pixels.per.inch div 72) * 12)"/>
e6b6c1
+      </xsl:when>
e6b6c1
+      <xsl:when test="$units='pt'">
e6b6c1
+        <xsl:value-of select="$unscaled.length * ($pixels.per.inch div 72)"/>
e6b6c1
+      </xsl:when>
e6b6c1
+      <xsl:when test="$units='px' or $units=''">
e6b6c1
+        <xsl:value-of select="$unscaled.length"/>
e6b6c1
+      </xsl:when>
e6b6c1
+      <xsl:otherwise>
e6b6c1
+        <xsl:message terminate="no">
e6b6c1
+          <xsl:text>"</xsl:text>
e6b6c1
+          <xsl:value-of select="$units"/>
e6b6c1
+          <xsl:text>" is not a known unit.  Applying scaling factor of 1 instead.</xsl:text>
e6b6c1
+        </xsl:message>
e6b6c1
+        <xsl:value-of select="$unscaled.length"/>
e6b6c1
+      </xsl:otherwise>
e6b6c1
+    </xsl:choose>
e6b6c1
+  </xsl:variable>
e6b6c1
+
e6b6c1
+  <func:result select="round($scaled.length)"/>
e6b6c1
+</func:function>
e6b6c1
+
e6b6c1
+<func:function name="dtbl:adjustColumnWidths">
e6b6c1
+  <xsl:param name="colgroup"/>
e6b6c1
+
e6b6c1
+  <xsl:if test="$adjustColumnWidths.debug">
e6b6c1
+    <xsl:message>
e6b6c1
+      <xsl:text>entering adjustColumnWidths(</xsl:text>
e6b6c1
+      <xsl:call-template name="dump-fragment">
e6b6c1
+        <xsl:with-param name="fragment" select="$colgroup"/>
e6b6c1
+      </xsl:call-template>
e6b6c1
+      <xsl:text>)</xsl:text>
e6b6c1
+    </xsl:message>
e6b6c1
+  </xsl:if>
e6b6c1
+
e6b6c1
+  <xsl:variable name="expanded.colgroup">
e6b6c1
+    <xsl:apply-templates select="exsl:node-set($colgroup)/*" mode="dtbl-split-widths"/>
e6b6c1
+  </xsl:variable>
e6b6c1
+
e6b6c1
+  <xsl:variable name="absolute.widths.total">
e6b6c1
+    <xsl:value-of select="sum(exsl:node-set($expanded.colgroup)//col/@abswidth)"/>
e6b6c1
+  </xsl:variable>
e6b6c1
+
e6b6c1
+  <xsl:variable name="relative.widths.total">
e6b6c1
+    <xsl:value-of select="sum(exsl:node-set($expanded.colgroup)//col/@relwidth)"/>
e6b6c1
+  </xsl:variable>
e6b6c1
+
e6b6c1
+  <xsl:if test="$adjustColumnWidths.debug">
e6b6c1
+    <xsl:message>
e6b6c1
+      <xsl:text>total relative widths = (</xsl:text>
e6b6c1
+      <xsl:value-of select="$relative.widths.total"/>
e6b6c1
+      <xsl:text>)</xsl:text>
e6b6c1
+    </xsl:message>
e6b6c1
+    <xsl:message>
e6b6c1
+      <xsl:text>total absolute widths = (</xsl:text>
e6b6c1
+      <xsl:value-of select="$absolute.widths.total"/>
e6b6c1
+      <xsl:text>)</xsl:text>
e6b6c1
+    </xsl:message>
e6b6c1
+  </xsl:if>
e6b6c1
+
e6b6c1
+  <xsl:variable name="adjusted.colgroup">
e6b6c1
+    <xsl:choose>
e6b6c1
+      <xsl:when test="$relative.widths.total = 0">
e6b6c1
+        <xsl:if test="$adjustColumnWidths.debug">
e6b6c1
+          <xsl:message>all widths are absolute</xsl:message>
e6b6c1
+        </xsl:if>
e6b6c1
+        
e6b6c1
+                             mode="dtbl-use-absolute-widths"/>
e6b6c1
+      </xsl:when>
e6b6c1
+      <xsl:when test="$absolute.widths.total = 0">
e6b6c1
+        <xsl:if test="$adjustColumnWidths.debug">
e6b6c1
+          <xsl:message>all widths are relative</xsl:message>
e6b6c1
+        </xsl:if>
e6b6c1
+        
e6b6c1
+                             mode="dtbl-use-relative-widths">
e6b6c1
+          
e6b6c1
+                          select="$relative.widths.total"/>
e6b6c1
+        </xsl:apply-templates>
e6b6c1
+      </xsl:when>
e6b6c1
+    </xsl:choose>
e6b6c1
+  </xsl:variable>
e6b6c1
+
e6b6c1
+  <xsl:variable name="corrected.adjusted.colgroup">
e6b6c1
+    <xsl:choose>
e6b6c1
+      <xsl:when test="$relative.widths.total = 0">
e6b6c1
+        <xsl:copy-of select="$adjusted.colgroup"/>
e6b6c1
+      </xsl:when>
e6b6c1
+      <xsl:otherwise>
e6b6c1
+        
e6b6c1
+                      select="sum(exsl:node-set($adjusted.colgroup)//col/@width)"/>
e6b6c1
+        
e6b6c1
+                      select="count(exsl:node-set($adjusted.colgroup)//col)"/>
e6b6c1
+        
e6b6c1
+                      select="100 - $widths.total"/>
e6b6c1
+        
e6b6c1
+                      select="($n.columns - $error) + 1"/>
e6b6c1
+        
e6b6c1
+                             mode="dtbl-correct-rounding-error">
e6b6c1
+          
e6b6c1
+                          select="$first.bad.column"/>
e6b6c1
+        </xsl:apply-templates>
e6b6c1
+      </xsl:otherwise>
e6b6c1
+    </xsl:choose>
e6b6c1
+  </xsl:variable>
e6b6c1
+
e6b6c1
+  <xsl:if test="$adjustColumnWidths.debug">
e6b6c1
+    <xsl:message>
e6b6c1
+      <xsl:text>result = (</xsl:text>
e6b6c1
+      <xsl:call-template name="dump-fragment">
e6b6c1
+        <xsl:with-param name="fragment" select="$corrected.adjusted.colgroup"/>
e6b6c1
+      </xsl:call-template>
e6b6c1
+      <xsl:text>)</xsl:text>
e6b6c1
+    </xsl:message>
e6b6c1
+  </xsl:if>
e6b6c1
+
e6b6c1
+  <func:result select="$corrected.adjusted.colgroup"/>
e6b6c1
+</func:function>
e6b6c1
+
e6b6c1
+<xsl:template match="colgroup" mode="dtbl-correct-rounding-error">
e6b6c1
+  <xsl:param name="first.bad.column"/>
e6b6c1
+
e6b6c1
+  <xsl:if test="$adjustColumnWidths.debug">
e6b6c1
+    <xsl:message>
e6b6c1
+      <xsl:text>first.bad.column = (</xsl:text>
e6b6c1
+      <xsl:value-of select="$first.bad.column"/>
e6b6c1
+      <xsl:text>)</xsl:text>
e6b6c1
+    </xsl:message>
e6b6c1
+  </xsl:if>
e6b6c1
+
e6b6c1
+  <colgroup>
e6b6c1
+    <xsl:for-each select="col[position() &lt; $first.bad.column]">
e6b6c1
+      <xsl:element name="col">
e6b6c1
+        <xsl:attribute name="width">
e6b6c1
+          <xsl:value-of select="concat(@width, '%')"/>
e6b6c1
+        </xsl:attribute>
e6b6c1
+      </xsl:element>
e6b6c1
+    </xsl:for-each>
e6b6c1
+    <xsl:for-each select="col[position() &gt;= $first.bad.column]">
e6b6c1
+      <xsl:element name="col">
e6b6c1
+        <xsl:attribute name="width">
e6b6c1
+          <xsl:value-of select="concat(@width + 1, '%')"/>
e6b6c1
+        </xsl:attribute>
e6b6c1
+      </xsl:element>
e6b6c1
+    </xsl:for-each>
e6b6c1
+  </colgroup>
e6b6c1
+</xsl:template>
e6b6c1
+
e6b6c1
+<xsl:template match="col" mode="dtbl-correct-rounding-error">
e6b6c1
+  <xsl:param name="relative.widths.total"/>
e6b6c1
+  <xsl:param name="error"/>
e6b6c1
+
e6b6c1
+  <xsl:element name="col">
e6b6c1
+    <xsl:attribute name="width">
e6b6c1
+      <xsl:value-of select="concat('', round((@relwidth div $relative.widths.total) * 100))"/>
e6b6c1
+    </xsl:attribute>
e6b6c1
+    <xsl:apply-templates mode="dtbl-use-absolute-widths"/>
e6b6c1
+  </xsl:element>
e6b6c1
+</xsl:template>
e6b6c1
+
e6b6c1
+<xsl:template match="colgroup" mode="dtbl-use-relative-widths">
e6b6c1
+  <xsl:param name="relative.widths.total"/>
e6b6c1
+
e6b6c1
+  <colgroup>
e6b6c1
+    <xsl:apply-templates mode="dtbl-use-relative-widths">
e6b6c1
+      
e6b6c1
+                      select="$relative.widths.total"/>
e6b6c1
+    </xsl:apply-templates>
e6b6c1
+  </colgroup>
e6b6c1
+</xsl:template>
e6b6c1
+
e6b6c1
+<xsl:template match="col" mode="dtbl-use-relative-widths">
e6b6c1
+  <xsl:param name="relative.widths.total"/>
e6b6c1
+
e6b6c1
+  <xsl:element name="col">
e6b6c1
+    <xsl:attribute name="width">
e6b6c1
+      <xsl:value-of select="round((@relwidth div $relative.widths.total) * 100)"/>
e6b6c1
+    </xsl:attribute>
e6b6c1
+    <xsl:apply-templates mode="dtbl-use-absolute-widths"/>
e6b6c1
+  </xsl:element>
e6b6c1
+</xsl:template>
e6b6c1
+
e6b6c1
+<xsl:template match="colgroup" mode="dtbl-use-absolute-widths">
e6b6c1
+  <colgroup>
e6b6c1
+    <xsl:apply-templates mode="dtbl-use-absolute-widths"/>
e6b6c1
+  </colgroup>
e6b6c1
+</xsl:template>
e6b6c1
+
e6b6c1
+<xsl:template match="col" mode="dtbl-use-absolute-widths">
e6b6c1
+  <xsl:element name="col">
e6b6c1
+    <xsl:attribute name="width">
e6b6c1
+      <xsl:value-of select="@abswidth"/>
e6b6c1
+    </xsl:attribute>
e6b6c1
+    <xsl:apply-templates mode="dtbl-use-absolute-widths"/>
e6b6c1
+  </xsl:element>
e6b6c1
+</xsl:template>
e6b6c1
+
e6b6c1
+<xsl:template match="colgroup" mode="dtbl-split-widths">
e6b6c1
+  <colgroup>
e6b6c1
+    <xsl:apply-templates mode="dtbl-split-widths"/>
e6b6c1
+  </colgroup>
e6b6c1
+</xsl:template>
e6b6c1
+
e6b6c1
+<xsl:template match="col" mode="dtbl-split-widths">
e6b6c1
+
e6b6c1
+  
e6b6c1
+  <xsl:variable name="width">
e6b6c1
+    <xsl:choose>
e6b6c1
+      <xsl:when test="@width != ''">
e6b6c1
+        <xsl:value-of select="@width"/>
e6b6c1
+      </xsl:when>
e6b6c1
+      <xsl:otherwise>
e6b6c1
+        <xsl:text>1*</xsl:text>
e6b6c1
+      </xsl:otherwise>
e6b6c1
+    </xsl:choose>
e6b6c1
+  </xsl:variable>
e6b6c1
+
e6b6c1
+  
e6b6c1
+  <xsl:variable name="absolute.width">
e6b6c1
+    <xsl:choose>
e6b6c1
+      <xsl:when test="contains($width, '*')">
e6b6c1
+        <xsl:value-of select="substring-after($width, '*')"/>
e6b6c1
+      </xsl:when>
e6b6c1
+      <xsl:otherwise>
e6b6c1
+        <xsl:value-of select="$width"/>
e6b6c1
+      </xsl:otherwise>
e6b6c1
+    </xsl:choose>
e6b6c1
+  </xsl:variable>
e6b6c1
+
e6b6c1
+  <xsl:variable name="converted.absolute.width">
e6b6c1
+    <xsl:choose>
e6b6c1
+      <xsl:when test="$absolute.width != ''">
e6b6c1
+        <xsl:value-of select="dtbl:convertLength($absolute.width)"/>
e6b6c1
+      </xsl:when>
e6b6c1
+     <xsl:otherwise>0</xsl:otherwise>
e6b6c1
+    </xsl:choose>
e6b6c1
+  </xsl:variable>
e6b6c1
+
e6b6c1
+  <xsl:variable name="relative.width">
e6b6c1
+    <xsl:choose>
e6b6c1
+      <xsl:when test="substring-before($width, '*') != ''">
e6b6c1
+        <xsl:value-of select="substring-before($width, '*')"/>
e6b6c1
+      </xsl:when>
e6b6c1
+      <xsl:otherwise>0</xsl:otherwise>
e6b6c1
+    </xsl:choose>
e6b6c1
+  </xsl:variable>
e6b6c1
+
e6b6c1
+  <xsl:element name="col">
e6b6c1
+    <xsl:attribute name="width">
e6b6c1
+      <xsl:value-of select="$width"/>
e6b6c1
+    </xsl:attribute>
e6b6c1
+    <xsl:attribute name="relwidth">
e6b6c1
+      <xsl:value-of select="$relative.width"/>
e6b6c1
+    </xsl:attribute>
e6b6c1
+    <xsl:attribute name="abswidth">
e6b6c1
+      <xsl:value-of select="$converted.absolute.width"/>
e6b6c1
+    </xsl:attribute>
e6b6c1
+    <xsl:apply-templates mode="dtbl-split-widths"/>
e6b6c1
+  </xsl:element>
e6b6c1
+</xsl:template>
e6b6c1
+
e6b6c1
+</xsl:stylesheet>
e6b6c1
diff -ruNp docbook-xsl-1.74.0.orig/html/table.xsl docbook-xsl-1.74.0/html/table.xsl
e6b6c1
--- docbook-xsl-1.74.0.orig/html/table.xsl	2008-06-01 23:36:39.000000000 +0200
e6b6c1
+++ docbook-xsl-1.74.0/html/table.xsl	2008-08-06 13:37:35.000000000 +0200
e6b6c1
@@ -5,7 +5,8 @@
e6b6c1
                 xmlns:xtbl="xalan://com.nwalsh.xalan.Table"
e6b6c1
                 xmlns:lxslt="http://xml.apache.org/xslt"
e6b6c1
                 xmlns:ptbl="http://nwalsh.com/xslt/ext/xsltproc/python/Table"
e6b6c1
-                exclude-result-prefixes="doc stbl xtbl lxslt ptbl"
e6b6c1
+                xmlns:dtbl="http://docbook.sourceforge.net/dtbl"
e6b6c1
+                exclude-result-prefixes="doc stbl xtbl lxslt ptbl dtbl"
e6b6c1
                 version='1.0'>
e6b6c1
 
e6b6c1
 <xsl:include href="../common/table.xsl"/>
e6b6c1
@@ -365,6 +366,9 @@
e6b6c1
           
e6b6c1
                           and $tablecolumns.extension != 0">
e6b6c1
             <xsl:choose>
e6b6c1
+              <xsl:when test="function-available('dtbl:convertLength')">
e6b6c1
+                <xsl:value-of select="dtbl:convertLength($table.width)"/>
e6b6c1
+              </xsl:when>
e6b6c1
               <xsl:when test="function-available('stbl:convertLength')">
e6b6c1
                 <xsl:value-of select="stbl:convertLength($table.width)"/>
e6b6c1
               </xsl:when>
e6b6c1
@@ -389,6 +393,9 @@
e6b6c1
       
e6b6c1
                       and $tablecolumns.extension != 0">
e6b6c1
         <xsl:choose>
e6b6c1
+          <xsl:when test="function-available('dtbl:adjustColumnWidths')">
e6b6c1
+            <xsl:copy-of select="dtbl:adjustColumnWidths($colgroup)"/>
e6b6c1
+          </xsl:when>
e6b6c1
           <xsl:when test="function-available('stbl:adjustColumnWidths')">
e6b6c1
             <xsl:copy-of select="stbl:adjustColumnWidths($colgroup)"/>
e6b6c1
           </xsl:when>
e6b6c1
diff -ruNp docbook-xsl-1.74.0.orig/lib/dumpfragment.xsl docbook-xsl-1.74.0/lib/dumpfragment.xsl
e6b6c1
--- docbook-xsl-1.74.0.orig/lib/dumpfragment.xsl	1970-01-01 01:00:00.000000000 +0100
e6b6c1
+++ docbook-xsl-1.74.0/lib/dumpfragment.xsl	2008-08-06 13:37:35.000000000 +0200
e6b6c1
@@ -0,0 +1,30 @@
e6b6c1
+
e6b6c1
+
e6b6c1
+                xmlns:exsl="http://exslt.org/common"
e6b6c1
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
e6b6c1
+                xmlns="http://www.w3.org/1999/xhtml"
e6b6c1
+                exclude-result-prefixes="exsl">
e6b6c1
+
e6b6c1
+<xsl:template name="dump-fragment">
e6b6c1
+  <xsl:param name="fragment"/>
e6b6c1
+  <xsl:apply-templates select="exsl:node-set($fragment)/*" mode="dump-fragment"/>
e6b6c1
+</xsl:template>
e6b6c1
+
e6b6c1
+<xsl:template match="@*" mode="dump-fragment">
e6b6c1
+  <xsl:text> </xsl:text>
e6b6c1
+  <xsl:value-of select="local-name(.)"/>
e6b6c1
+  <xsl:text>="</xsl:text>
e6b6c1
+  <xsl:value-of select="."/>
e6b6c1
+  <xsl:text>"</xsl:text>
e6b6c1
+</xsl:template>
e6b6c1
+
e6b6c1
+<xsl:template match="*" mode="dump-fragment">
e6b6c1
+  <xsl:text><</xsl:text><xsl:value-of select="local-name(.)"/>
e6b6c1
+  <xsl:apply-templates select="@*" mode="dump-fragment"/>
e6b6c1
+  <xsl:text>></xsl:text>
e6b6c1
+  <xsl:apply-templates mode="dump-fragment"/>
e6b6c1
+  <xsl:text></</xsl:text><xsl:value-of select="local-name(.)"/>
e6b6c1
+  <xsl:text>></xsl:text>
e6b6c1
+</xsl:template>
e6b6c1
+
e6b6c1
+</xsl:stylesheet>
e6b6c1
diff -urNp docbook-xsl-1.76.0-orig/html/param.xsl docbook-xsl-1.76.0/html/param.xsl
e6b6c1
--- docbook-xsl-1.76.0-orig/html/param.xsl	2010-08-31 09:27:22.000000000 +0200
e6b6c1
+++ docbook-xsl-1.76.0/html/param.xsl	2010-09-06 11:01:07.916914161 +0200
e6b6c1
@@ -68,6 +68,7 @@ div.annotation-close { position: absolut
e6b6c1
 http://docbook.sourceforge.net/release/images/annot-close.png</xsl:param>
e6b6c1
 <xsl:param name="annotation.graphic.open">http://docbook.sourceforge.net/release/images/annot-open.png</xsl:param>
e6b6c1
 
e6b6c1
+<xsl:param name="adjustColumnWidths.debug" select="false()"/>
e6b6c1
 <xsl:param name="annotation.js">
e6b6c1
 <xsl:text>http://docbook.sourceforge.net/release/script/AnchorPosition.js http://docbook.sourceforge.net/release/script/PopupWindow.js</xsl:text></xsl:param>
e6b6c1