problem with parsing of colspecs in table.mod.xsl

Brian McGurk <[email protected]> Thu, 11 Dec 2003 18:57:13 +0000
Newsgroups gmane.text.docbook.db2latex.general
Message-ID <[email protected]>
Hi,

I found that the sizing of columns in tables didn't seem to work
properly. In particular, using the colwidth attribute to a
colspec element didn't translate into the use of the tabularx
environment. I've included a patch which seems to fix the problem,
at least for the tables in my document. 'xsltproc --version' on my 
machine reports:
  Using libxml 20504, libxslt 10027 and libexslt 718
  xsltproc was compiled against libxml 20504, libxslt 10027 and libexslt 718
  libxslt 10027 was compiled against libxml 20504
  libexslt 718 was compiled against libxml 20504

Does the patch look right? 

Brian


---------------------------------------------------------------------

diff -r -u /usr/local/share/xsl/db2latex-0.7/xsl/table.mod.xsl /usr/local/share/xsl/db2latex-0.7-LocalPatch/xsl/table.mod.xsl
--- /usr/local/share/xsl/db2latex-0.7/xsl/table.mod.xsl	2003-04-14 20:31:46.000000000 +0100
+++ /usr/local/share/xsl/db2latex-0.7-LocalPatch/xsl/table.mod.xsl	2003-12-09 14:54:40.000000000 +0000
@@ -101,7 +101,7 @@
 	    <xsl:when test="$i > $cols"></xsl:when>
 	    <!-- There are still columns to count -->
 	    <xsl:otherwise>
-		<xsl:variable name="width" select="colspec[@colnum=$i]/@colwidth"/>
+		<xsl:variable name="width" select="./colspec[$i]/@colwidth"/>
 		<!-- Try to take heed of colspecs -->
 		<xsl:choose>
 			<xsl:when test="$width!=''">
@@ -248,11 +248,11 @@
 	<xsl:variable name="usex">
 		<xsl:choose>
 			<!-- if there are instances of 1*-style colwidths, we need tabularx -->
-			<xsl:when test="$latex.use.tabularx=1 and contains(colspec/@colwidth,'*')">
+			<xsl:when test="$latex.use.tabularx=1 and contains(./colspec/@colwidth,'*')">
 				<xsl:text>1</xsl:text>
 			</xsl:when>
 			<!-- if there are colspecs with 'justify' alignment and no explicit width, we need tabularx -->
-			<xsl:when test="$latex.use.tabularx=1 and count(colspec[@align='justify'])&gt;0">
+			<xsl:when test="$latex.use.tabularx=1 and count(./colspec[@align='justify'])&gt;0">
 				<xsl:text>1</xsl:text>
 			</xsl:when>
 			<xsl:otherwise>

----------------------------------------------------------------




-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click