This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Stange Table problem


All,

Ever since 1.48+, I have been using two modification to table templates, 
which have been working fine. Allthough I have been updating Norm 
stylesheets regulary, I somehow never had time to update the table stuff.


With the release of 1.53.0, I thought now was the time to do a major 
cleanup. I am limited by the the deficiencies in the table implementation 
of Fop 0.20.4, but that have never been a big problem.

Using Saxon 6.5.1 and the enclosed XML and XSL file, things works so-so. 
(except that empty cells have no border, or is it cells with isn't 
explicit defined). This seem to be a NEW PROBLEM with tables in 1.53.0


Since Norm, no longer use the (unimplemented in FOP) 
fo:table-with-caption, I thought I could just erase my modification of 
the table matching template, but this does not work. I have been debugging 
this for quite a while, but havn't been able to find the problem. FOP just 
collapse with the post 1.48+ table templates !!


Regards,

Jens


----------

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V42CR1//EN"  
                      "../dtd/docbkx42CR1/docbookx.dtd">


<book id="v2">

<bookinfo>
   <title>Table Demo</title>
   <corpauthor>John Doe Inc.</corpauthor>
   <volumenum>2</volumenum>
</bookinfo>


<!-- 
 *****************************************************************
                    C H A P T E R - 1
 ***************************************************************** 
-->

<chapter id="v2c-int"><title>Introduction</title>


<sect1 id="v2s1-int-bck"><title>Background</title>



<table id="v2t-isdsc" orient="land" frame="all">
<title>My Title</title>
<tgroup cols="21">
<colspec colwidth="18*"/>
<colspec colwidth="25*"/>
<colspec colwidth="3*" align="center" colname="1a"/>
<colspec colwidth="3*" align="center" colname="1b"/>
<colspec colwidth="3*" align="center" colname="1c"/>
<colspec colwidth="3*" align="center" colname="2a"/>
<colspec colwidth="3*" align="center" colname="2b"/>
<colspec colwidth="3*" align="center" colname="2c"/>
<colspec colwidth="3*" align="center" colname="2d"/>
<colspec colwidth="3*" align="center" colname="2e"/>
<colspec colwidth="3*" align="center" colname="2f"/>
<colspec colwidth="3*" align="center" colname="2g"/>
<colspec colwidth="3*" align="center" colname="2h"/>
<colspec colwidth="3*" align="center" colname="3a"/>
<colspec colwidth="3*" align="center" colname="3b"/>
<colspec colwidth="3*" align="center" colname="3c"/>
<colspec colwidth="3*" align="center" colname="3d"/>
<colspec colwidth="3*" align="center" colname="3e"/>
<colspec colwidth="3*" align="center" colname="3f"/>
<colspec colwidth="3*" align="center" colname="4a"/>
<colspec colwidth="3*" align="center" colname="4b"/>
<thead>
  <row>
    <entry>IT Services</entry>
    <entry>Class</entry>
    <entry>1.A</entry>
    <entry>1.B</entry>
    <entry>1.C</entry>
    <entry>2.A</entry>
    <entry>2.B</entry>
    <entry>2.C</entry>
    <entry>2.D</entry>
    <entry>2.E</entry>
    <entry>2.F</entry>
    <entry>2.G</entry>
    <entry>2.H</entry>
    <entry>3.A</entry>
    <entry>3.B</entry>
    <entry>3.C</entry>
    <entry>3.D</entry>
    <entry>3.E</entry>
    <entry>3.F</entry>
    <entry>4.A</entry>
    <entry>4.B</entry>
  </row>
</thead>
<tbody>
  <row>
    <entry>User Interface</entry>
    <entry>GUI</entry>
    <entry colname="2a">X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
  </row>
  <row>
    <entry/>
    <entry>Look &amp; Feel</entry>
    <entry colname="2a">X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
    <entry>X</entry>
  </row>
  <row>
    <entry/>
    <entry>Toolkit</entry>
  </row>
  <row>
    <entry>Data Management</entry>
    <entry>Dictionary/Directory</entry>
    <entry colname="2b">X</entry>
    <entry colname="2d">X</entry>
    <entry colname="3a">X</entry>
    <entry colname="4a">X</entry>
  </row>
  <row>
    <entry/>
    <entry>DBMS (relational)</entry>
    <entry colname="2b">X</entry>
    <entry colname="2d">X</entry>
    <entry colname="3b">X</entry>
    <entry colname="4a">X</entry>
    <entry colname="4b">X</entry>
  </row>
  <row>
    <entry/>
    <entry>DBMS (object-oriented)</entry>
    <entry colname="3b">X</entry>
    <entry colname="4a">X</entry>
    <entry colname="4b">X</entry>
  </row>
  <row>
    <entry/>
    <entry>Distributed Data</entry>
    <entry colname="3b">X</entry>
    <entry colname="4a">X</entry>
    <entry colname="4b">X</entry>
  </row>
  <row>
    <entry/>
    <entry>Remote Data Access</entry>
    <entry colname="3b">X</entry>
    <entry colname="4a">X</entry>
    <entry colname="4b">X</entry>
  </row>
  <row>
    <entry/>
    <entry>Database Replication</entry>
    <entry colname="3b">X</entry>
    <entry colname="4a">X</entry>
    <entry colname="4b">X</entry>
  </row>
  <row>
    <entry/>
    <entry>NATO Common Schema</entry>
    <entry colname="3b">X</entry>
    <entry colname="4a">X</entry>
  </row>
  <row>
    <entry>Data Interchange</entry>
    <entry>Graphics</entry>
  </row>

</tbody>
</tgroup>
</table>


</sect1>


</chapter>


</book>

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


<?xml version='1.0'?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:fo="http://www.w3.org/1999/XSL/Format";
                version='1.0'
                xmlns:stbl="http://nwalsh.com/xslt/ext/com.nwalsh.saxon.Table";
                xmlns:xtbl="com.nwalsh.xalan.Table"
                xmlns="http://www.w3.org/TR/xhtml1/transitional";
                exclude-result-prefixes="#default stbl xtbl">

<xsl:import href="../docbook-xsl/fo/docbook.xsl"/>

<xsl:output method="xml" indent="yes"/>


<!-- Processor Extensions -->

<xsl:param name="fop.extensions" select="1"/> <!-- For now, only PDF bookmarks -->

<xsl:param name="xep.extensions" select="0"/> 


<!-- Stylesheet Extensions -->

<!-- Normally set to 1, but FOP don't like 10% in colspec -->
<xsl:param name="tablecolumns.extension" select="0"/> 
<xsl:param name="use.extensions" select="1"/>

<!-- Tables -->

<xsl:param name="default.table.width" select="'16cm'"/>


<!-- Pagination and General Styles-->

<xsl:param name="paper.type" select="'A4'"/>
<xsl:param name="double.sided" select="1"/>

<!-- The letter A-H refers to the figure describing page 
     setup in the DocBook XSL-FO documentation -->

<xsl:param name="page.margin.top" select="'15mm'"/>          <!-- A -->
<xsl:param name="region.before.extent" select="'42pt'"/>     <!-- B -->
<xsl:param name="body.margin.top" select="'56pt'"/>          <!-- C -->

<xsl:param name="region.after.extent" select="'46pt'"/>      <!-- D -->
<xsl:param name="page.margin.bottom" select="'15mm'"/>       <!-- E -->
<xsl:param name="body.margin.bottom" select="'60pt'"/>       <!-- F -->

<xsl:param name="page.margin.inner" select="'25mm'"/>        <!-- G -->
<xsl:param name="page.margin.outer" select="'25mm'"/>        <!-- H -->



<!-- ....................................................................

     Source: fo/table.xsl,v 1.17  - DocBook XSL 1.48+ 

     Descr.: We assume all colspecs comes in form 20*, where 20* means
             20% of max width. This also means, that the sum of all collumns
             must never be more than 100 %.(btw. we talk about 100 % of the
             parameter $default.table.width

             We shouldn't actually need to do this, but for some reason, FOP 
             can not understand, when the * is translated to %.

     .................................................................... --> 


<!-- Special version of calc.column.width. -->


<xsl:template name="calc.column.width">
  <xsl:param name="colwidth">1*</xsl:param>

  <xsl:choose>
    <xsl:when test="contains($colwidth, '*')">

      <xsl:variable name="proportional"
                    select="substring-before($colwidth, '*')"/>

      <xsl:variable name="width-units" select="$default.table.width"/>

      <!-- Grab the width part by blanking out the units part and
           discarding whitespace. It's not pretty, but it works. -->
      <xsl:variable name="width"
         select="normalize-space(
                     translate($width-units,
                               '+-0123456789.abcdefghijklmnopqrstuvwxyz',
                               '+-0123456789.'))"/>

      <!-- Grab the units part by blanking out the width part and discarding
           whitespace. It's not pretty, but it works. -->
      <xsl:variable name="units"
           select="normalize-space(
                        translate($width-units,
                                  'abcdefghijklmnopqrstuvwxyz+-0123456789.',
                                  'abcdefghijklmnopqrstuvwxyz'))"/>

      <xsl:value-of select="$proportional * $width div 100.0"/>
      <xsl:value-of select="$units"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-imports/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>



<!-- ....................................................................


     Source: fo/formal.xsl,v 1.8  - DocBook XSL 1.48+ 

     Descr.:

     .................................................................... --> 


<xsl:template match="table">
  <xsl:variable name="id">
    <xsl:call-template name="object.id"/>
  </xsl:variable>
  
  <xsl:variable name="param.placement"
                select="substring-after(normalize-space($formal.title.placement),
                                        concat(local-name(.), ' '))"/>

  <xsl:variable name="placement">
    <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:variable>

  <xsl:variable name="prop-columns"
    select=".//colspec[contains(@colwidth, '*')]"/>

  <fo:block>
    <xsl:attribute name="span">
      <xsl:choose>
        <xsl:when test="@pgwide=1">all</xsl:when>
        <xsl:otherwise>none</xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
    <xsl:if test="@orient='land'">
      <xsl:attribute name="reference-orientation">90</xsl:attribute>
    </xsl:if>


<!-- Commented out by JS

    <fo:table-and-caption id="{$id}"
                          xsl:use-attribute-sets="formal.object.properties"
                          keep-together.within-column="1">
      <fo:table-caption>
-->


        <fo:block xsl:use-attribute-sets="formal.title.properties">
          <xsl:apply-templates select="." mode="object.title.markup"/>
        </fo:block>

<!--
      </fo:table-caption>
-->

      <fo:table id="{$id}"
                    xsl:use-attribute-sets="formal.object.properties"
                    keep-together.within-column="1">
        <xsl:call-template name="table.frame"/>
        <xsl:if test="count($prop-columns) != 0">
          <xsl:attribute name="table-layout">fixed</xsl:attribute>
        </xsl:if>
        <xsl:apply-templates select="tgroup"/>
      </fo:table>
<!--
      Commented out by JS
    </fo:table-and-caption>
--> 
  </fo:block>
</xsl:template>





</xsl:stylesheet>




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]