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