Next in thread → Next in month →

Re: [docbook-apps] Help! Tables

From
Lillian Sullam <>
Date
2008-10-03T18:21:40+00:00
ID
Thread
Re: [docbook-apps] Help! Tables
2008/10/3 Bob Stayton <>

Hi,

When I process your XML file with the stock DocBook 
stylesheets, xep.extensions="1", and XEP 4.9, then the table's column 
specs look like this in the FO file:

 

<fo:table-column 
column-number="1"/>

<fo:table-column 
column-number="2"/>

 

In your FO file, they look like this:

 

<fo:table-column column-number="1" 
column-width="50%"/>

<fo:table-column column-number="2" 
column-width="50%"/>

 

I suspect you have set the stylesheet parameter 
$tablecolumns.extension=1.  Set that back to zero and it should work 
fine.  That extension is not needed with conformant XSL-FO 
processors.  

 

Bob Stayton
Sagehill Enterprises


 

 

  
----- Original Message ----- 

  

From: 
  Lillian 
  Sullam 

  
To: Bob Stayton 

  

Sent: Friday, October 03, 2008 8:37 
  AM

  
Subject: Re: [docbook-apps] Help! 
  Tables

  

  
Hi Bob,

Attached is a Zip folder with the input XML file 
  and the output FO file.  Thanks!

Lillian

  
2008/10/1 Bob Stayton <>

  
    

    
Hi,

    
I meant could you please send me the complete 
    files as attachements?  Thanks.

    

    
 

    
Bob Stayton
Sagehill Enterprises


    
 

    
 

    
      

      
----- 
      Original Message ----- 

      

From: 
      Lillian Sullam 

      
To: 
      Bob Stayton 

      

      

      

      
Sent: 
      Wednesday, October 01, 2008 4:46 PM

      
Subject: 
      Re: [docbook-apps] Help! Tables

      

      
XML input
<informaltable 
      frame="topbot">
       <tgroup 
      cols='2' colsep="0" 
      rowsep="0">
            
      <colspec colnum='1' colname='col1' 
      align='right'/>
            
      <colspec colnum='2' colname='col2' 
      align='left'/>

        
      <thead 
      rowsep='1'>
          
      <row>
            
      

FO Output
<fo:block space-before.minimum="0.5em" 
      space-before.optimum="1em" space-before.maximum="2em" 
      space-after.minimum="0.5em" space-after.optimum="1em" 
      space-after.maximum="2em" id="d0e1484">
$B!](B
<fo:table 
      border-before-width.conditionality="retain" border-collapse="collapse" 
      border-left-style="none" border-right-style="none" 
      border-top-style="solid" border-bottom-style="solid" 
      border-top-width="0.5pt" border-bottom-width="0.5pt" 
      border-top-color="black" border-bottom-color="black" 
      width="auto">
<fo:table-column column-number="1" 
      column-width="50%"/>
<fo:table-column column-number="2" 
      column-width="50%"/>
$B!](B
<fo:table-header start-indent="0pt" 
      end-indent="0pt">
$B!](B
<fo:table-row 
      keep-with-next.within-column="always">

I hope this helps. This 
      seemed like the most important parts. If you need a larger section let me 
      know.  Thanks!

Lillian

      
On Wed, Oct 1, 2008 at 4:25 PM, Bob Stayton <> wrote:

      
        

        
Hi,

        
Strange.  Could you send me your 
        (short) xml input and fo output?

        

        
 

        
Bob Stayton
Sagehill Enterprises


        
 

        
 

        
          

          
----- 
          Original Message ----- 

          

From: 
          Lillian Sullam 

          
To: 
          Bob Stayton 

          

          

          

          
Sent: 
          Tuesday, September 30, 2008 11:10 AM

          
Subject: 
          Re: [docbook-apps] Help! Tables

          

          
Hi Bob,

I took a look at the FO output and there 
          is no "table-layout='fixed' on the fo:table element.  I also took 
          a look at the fo/table.xsl in the docbook xsl and it looks fine, I 
          haven't done anything to those files.  My xep.extentions is set 
          to 1.  I have proportional spacing for my header tables.  
          Could that effect my regular tables?

Lillian 

          
On Mon, Sep 29, 2008 at 1:18 PM, Bob Stayton 
          <> wrote:

          
            

            
Take a peek inside the FO that is 
            generated to see if there is a table-layout="fixed" property on the 
            fo:table element.  There should not be, and so XEP should use 
            the default table-layout="auto".  If there is a "fixed" value, 
            then something is going on with the stylesheet, because that should 
            only be output if proportional columns are used or if 
            $fop.extensions is non-zero.

            

            
 

            
Bob Stayton
Sagehill Enterprises


            
 

            
 

            
              

              
----- 
              Original Message ----- 

              

From: 
              Lillian Sullam 

              
To: 
              Bob Stayton 

              

              

              

              
Sent: 
              Monday, September 29, 2008 12:08 PM

              
Subject: 
              Re: [docbook-apps] Help! Tables

              

              
Right, I no longer have proportional widths. I do not 
              specify widths at all, but my table (which otherwise looks how I 
              would like it) still spreads the content across the whole length 
              of the page. 

length of 
              page
----------------------------------------------------------------------------------------

Some 
              text in a 
              paragraph.

table:

___________________________________________________
type                                         
              comments
___________________________________________________
                                     
              0         
              Text
                                     
              1         
              Text
___________________________________________________

More 
              text in a 
              paragraph.

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

I'm 
              sorry for harping on this point, but I've been racking my brain to 
              try to understand why this is happening.  I am using the 
              table code you originally sent me. The alignment is great, the 
              frames are great, but the span is 
              problematic.

Lillian

              
On Mon, Sep 29, 2008 at 11:40 AM, Bob 
              Stayton <> wrote:

              
                

                
Hi,

                
Perhaps you didn't see this 
                paragraph in my earlier mail?

                

                
 

                

                
Also, any time you include a 
                proportional column specfication that has "*" means the table 
                will take up the full-width of the available space.  If you 
                leave out column width specifications, then the stylesheet will 
                use table-layout="auto" (with XEP and Antenna House which 
                support it) and the table width will try to fit the 
                data.

                
 

                

                
Bob Stayton
Sagehill Enterprises


                
 

                
 

                
                  

                  
----- 
                  Original Message ----- 

                  

From: 
                  Lillian Sullam 

                  
To: 
                  Bob Stayton 

                  

                  

                  

                  
Sent: 
                  Monday, September 29, 2008 11:29 AM

                  
Subject: 
                  Re: [docbook-apps] Help! Tables

                  

                  
It was my customizations!  I began the 
                  customization work because I do not want the tables to span 
                  the full width of the page, but instead, I want the columns to 
                  be as wide as the longest line of content.  Is this 
                  possible with CALS?  Thank you so much for your help thus 
                  far!

Lillian

                  
On Mon, Sep 29, 2008 at 10:55 AM, Bob 
                  Stayton <> wrote:

                  
                    

                    
First test with the stock 
                    stylesheets.  That will tell you if the problem is with 
                    your customization.

                    

                    
 

                    
Bob Stayton
Sagehill Enterprises


                    
 

                    
 

                    
                      

                      
----- 
                      Original Message ----- 

                      

From: 
                      Lillian 
                      Sullam 

                      
To: 
                      Bob Stayton 

                      

                      

                      

                      
Sent: 
                      Monday, September 29, 2008 10:51 AM

                      
Subject: 
                      Re: [docbook-apps] Help! Tables

                      

                      
I do use XEP (a trial version right now). I 
                      made some customizations and I use my customized 
                      stylesheet.

I have commented some items out 
                      (because I didn't want to delete them in case they were 
                      not the issue). Perhaps my problem lies in the 
                      customization?

Here is what it looks 
                      like:

<!-- Table -->
<xsl:param 
                      name="default.table.frame">all</xsl:param>

<xsl:attribute-set 
                      name="table.cell.padding">
  <xsl:attribute 
                      name="padding-left">5pt</xsl:attribute>
  
                      <xsl:attribute 
                      name="padding-right">5pt</xsl:attribute>
  
                      <xsl:attribute 
                      name="padding-top">2pt</xsl:attribute>
  
                      <xsl:attribute 
                      name="padding-bottom">2pt</xsl:attribute>
</xsl:attribute-set>
<!--
<xsl:param 
                      name="html.cellpadding">5%</xsl:param>
-->
<xsl:attribute-set 
                      name="table.table.properties">
  
                      <xsl:attribute 
                      name="border-before-width.conditionality">retain</xsl:attribute>
  
                      <xsl:attribute 
                      name="border-collapse">collapse</xsl:attribute>
</xsl:attribute-set>

<!--
<xsl:attribute-set 
                      name="table.properties">
  <xsl:attribute 
                      name="align"><xsl:value-of 
                      select="$alignment"/></xsl:attribute>
</xsl:attribute-set>
-->

    
                      <!-- New Table additions 
                      -->
<!--
    <xsl:param 
                      name="default.table.width">1</xsl:param>
-->    
                      
    <xsl:param 
                      name="table.frame.border.style">solid</xsl:param>
    
                      <xsl:param 
                      name="table.cell.border.style">solid</xsl:param>
    
                      
    <xsl:param 
                      name="tablecolumns.extension" 
                      select="1"/>
    
                      
    <xsl:template 
                      name="table.cell.properties">
    
                      <!-- HTML table 
                      -->
      <xsl:variable 
                      name="border" 
                      
                    
                      select="(ancestor::table 
                      |
                             
                      ancestor::informaltable)[last()]/@border"/>
      
                      <xsl:if test="$border != '' and $border != 
                      0">
        
                      <xsl:attribute 
                      name="border">
          
                      <xsl:value-of 
                      select="none"/>
          
                      <xsl:text> 
                      </xsl:text>
          
                      <xsl:value-of 
                      select="none"/>
          
                      <xsl:text> 
                      </xsl:text>
          
                      <xsl:value-of 
                      select="none"/>
        
                      </xsl:attribute>
      
                      </xsl:if>
    
                      </xsl:template>
    
                          
    
                          <!-- Table Centering (only works for 
                      XEP) -->
      <xsl:template 
                      name="table.layout">
      
                      <xsl:param 
                      name="table.content"/>

      
                      <fo:table width="100%">
    
                          <fo:table-column 
                      column-width="proportional-column-width(1)"/>
    
                          <fo:table-column 
                      column-width="proportional-column-width(10)"/>
    
                          <fo:table-column 
                      column-width="proportional-column-width(1)"/>
    
                          <fo:table-body 
                      start-indent="0pt">
    
                            
                      <fo:table-row>
    
                              
                      <fo:table-cell/>
    
                              
                      <fo:table-cell>
    
                                
                      <fo:block>
        
                              
                       <xsl:copy-of 
                      select="$table.content"/>
    
                                
                      </fo:block>
<!--
    
                                
                      <fo:table>
    
                                  
                      <fo:table-body 
                      start-indent="0pt">
    
                                    
                      <fo:table-row><fo:table-cell><fo:block>
    
                                      
                      <xsl:copy-of 
                      select="$table.content"/>
    
                                     
                      </fo:block></fo:table-cell></fo:table-row>
    
                                  
                      </fo:table-body>
    
                                
                      </fo:table>
-->
    
                              
                      </fo:table-cell>
    
                              
                      <fo:table-cell/>
    
                            
                      </fo:table-row>
    
                          
                      </fo:table-body>
      
                      </fo:table>
      
                      </xsl:template>
      
                      
      <!-- Table Frames 
                      -->
      <xsl:template 
                      name="table.frame">
      
                      <xsl:variable name="frame">
    
                          
                      <xsl:choose>
    
                            <xsl:when 
                      test="../@frame">
    
                              
                      <xsl:value-of 
                      select="../@frame"/>
    
                            
                      </xsl:when>
    
                            <xsl:when 
                      test="$default.table.frame != 
                      ''">
    
                              
                      <xsl:value-of 
                      select="$default.table.frame"/>
    
                            
                      </xsl:when>
    
                            
                      <xsl:otherwise>all</xsl:otherwise>
    
                          
                      </xsl:choose>
      
                      </xsl:variable>

      
                      <xsl:choose>
    
                          <xsl:when 
                      test="$frame='all'">
    
                            <xsl:attribute 
                      name="border-left-style">none
    
                              
                      <!--xsl:value-of 
                      select="$table.frame.border.style"/-->
    
                            
                      </xsl:attribute>
    
                            <xsl:attribute 
                      name="border-right-style">none
    
                              
                      <!--xsl:value-of 
                      select="$table.frame.border.style"/-->
    
                            
                      </xsl:attribute>
    
                            <xsl:attribute 
                      name="border-top-style">
    
                              
                      <xsl:value-of 
                      select="$table.frame.border.style"/>
    
                            
                      </xsl:attribute>
    
                            <xsl:attribute 
                      name="border-bottom-style">
    
                              
                      <xsl:value-of 
                      select="$table.frame.border.style"/>
    
                            
                      </xsl:attribute>
    
                            <xsl:attribute 
                      name="border-left-width">
    
                              
                      <xsl:value-of 
                      select="$table.frame.border.thickness"/>
    
                            
                      </xsl:attribute>
    
                            <xsl:attribute 
                      name="border-right-width">
    
                              
                      <xsl:value-of 
                      select="$table.frame.border.thickness"/>
    
                            
                      </xsl:attribute>
    
                            <xsl:attribute 
                      name="border-top-width">
    
                              
                      <xsl:value-of 
                      select="$table.frame.border.thickness"/>
    
                            
                      </xsl:attribute>
    
                            <xsl:attribute 
                      name="border-bottom-width">
    
                              
                      <xsl:value-of 
                      select="$table.frame.border.thickness"/>
    
                            
                      </xsl:attribute>
    
                            <xsl:attribute 
                      name="border-left-color">
    
                              
                      <xsl:value-of 
                      select="$table.frame.border.color"/>
    
                            
                      </xsl:attribute>
    
                            <xsl:attribute 
                      name="border-right-color">
    
                              
                      <xsl:value-of 
                      select="$table.frame.border.color"/>
    
                            
                      </xsl:attribute>
    
                            <xsl:attribute 
                      name="border-top-color">
    
                              
                      <xsl:value-of 
                      select="$table.frame.border.color"/>
    
                            
                      </xsl:attribute>
    
                            <xsl:attribute 
                      name="border-bottom-color">
    
                              
                      <xsl:value-of 
                      select="$table.frame.border.color"/>
    
                            
                      </xsl:attribute>
    
                          </xsl:when>
    
                        </xsl:choose>
    
                      </xsl:template>

                      
On Mon, Sep 29, 2008 at 10:43 AM, 
                      Bob Stayton <> wrote:

                      
                        

                        
Saxon is fine.  You 
                        said you were using XEP, right?  Are you using your 
                        stylesheet customization or are you using the stock 
                        DocBook stylesheets?

                        

                        
 

                        
Bob Stayton
Sagehill Enterprises


                        
 

                        
 

                        
                          

                          
----- 
                          Original Message ----- 

                          

From: 
                          Lillian Sullam 

                          

                          

                          

                          
To: 
                          Bob 
                          Stayton 

                          
Sent: 
                          Monday, September 29, 2008 10:22 AM

                          
Subject: 
                          Re: [docbook-apps] Help! Tables

                          

                          
Hello,

Thank you for the 
                          suggestions.  I tried the code you sent me, but 
                          the output is still incorrect.  For some reason, 
                          there are no table lines at all and none of the text 
                          followed the "align" specifications.

It looks 
                          like

type                      
                          comments
0                           
                          small group of binning 
                          settings
1                           
                          range of binning settings starting from 1

Could 
                          it be my XSLT processor?  I'm currently using 
                          Saxon 6.5.5

Lillian  

                          
On Mon, Sep 29, 2008 at 9:47 
                          AM, Bob Stayton <> 
                          wrote:

                          
                            

                            
Hi,

                            
A CALS table can be 
                            formatted the way you want.  Your CALS example 
                            included a rules="rows" attribute, but there is no 
                            such attribute on table or informaltable.  I 
                            think you wanted rowsep="1", and you only wanted it 
                            on the header row.  The outside borders on a 
                            CALS table is handled using the frame 
                            attribute.

                            
 

                            
Also, any time you 
                            include a proportional column specfication that has 
                            "*" means the table will take up the full-width of 
                            the available space.  If you leave out column 
                            width specifications, then the stylesheet will use 
                            table-layout="auto" (with XEP and Antenna House 
                            which support it) and the table width will try 
                            to fit the data.

                            
 

                            
Try this:

                            
 

                            
<informaltable 
                            frame="topbot">
       
                            <tgroup cols='2' colsep="0" 
                            rowsep="0">
            
                            <colspec colnum='1' colname='col1' 
                            align='right'/>
            
                            <colspec colnum='2' colname='col2' 
                            align='left'/> 
                            

        
                            <thead 
                            rowsep='1'>
          
                            <row>
            
                            <entry 
                            align='left'>type</entry>
            
                            <entry>comments</entry>
          
                            </row>
          
                            </thead>
          
                            <tbody>
          
                            <row>
            
                            <entry 
                            align='right'>0</entry>
            
                            <entry>small group of binning 
                            settings</entry>
          
                            </row>
          
                            <row>
            
                            <entry>1</entry>
            
                            <entry>range of binning settings starting from 
                            1</entry>
          
                            </row>
        
                            </tbody>
        
                            </tgroup>
</informaltable>

                            
Bob Stayton
Sagehill Enterprises


                            

                            

                            

                            
 

                            
 

                            
                              
----- 
                              Original Message ----- 

                              

From: 
                              Lillian Sullam 

                              
To: 
                               
                              

                              
Sent: 
                              Friday, September 26, 2008 1:49 PM

                              
Subject: 
                              [docbook-apps] Help! Tables

                              

                              
Hello,

I'm trying to format my 
                              tables (mainly for PDF output appearance, but a 
                              general look nonetheless).

Here is what I 
                              would 
                              like:

______________________
Column1   
                              Column 2_____

      
                                   1   Some text 
                              here
           
                              2   Some text 
                              here
         
                              ...    
                              ...
______________________

The basic 
                              idea is that numbers would be right aligned and 
                              text would be left. The size of the table is 
                              determined by the longest row.

I've tried 
                              making the tables with HTML and CALS, but my 
                              results are not satisfactory.  With HTML 
                              tables I get the size right, but no text 
                              alignment.  With CALS tables I can control 
                              the border appearance, but not the row separation, 
                              and the text does not align correctly.

Here 
                              is my code:

WITH CALS
<informaltable 
                              rules="rows"> 
    
                                 <tgroup 
                              cols='2'>
    
                                      <colspec 
                              colnum='1' colname='col1' colwidth='1*' 
                              align='right'/>
    
                                      <colspec 
                              colnum='2' colname='col2' 
                              colwidth='4*'/>
        
                              <thead 
                              rowsep='1'>
          
                              <row>
            
                              <entry 
                              align='left'>type</entry>
            
                              <entry>comments</entry>
          
                              </row>
    
                                    
                              </thead>
    
                                    
                              <tbody>
          
                              <row>
            
                              <entry 
                              align='right'>0</entry>
            
                              <entry>small group of binning 
                              settings</entry>
          
                              </row>
          
                              <row>
            
                              <entry>1</entry>
            
                              <entry>range of binning settings starting 
                              from 
                              1</entry>
          
                              </row>
        
                              </tbody>
    
                                  
                              </tgroup>
</informaltable>

WITH 
                              HTML
<informaltable>
    
                              <colgroup>
    
                                  <col 
                              align="right"/>
    
                                  
                              <col/>
    
                              </colgroup>
    
                              <thead>
          
                              <tr>
            
                              <th 
                              align="left">type</th>
            
                              <th>comments</th>     
                                  
                              
          
                              </tr>
     
                              </thead>
      
                              <tbody>
          
                              <tr>
            
                              <td>0</td>
            
                              <td>small group of binning 
                              settings</td>      
                                  
                              
          
                              </tr>
          
                              <tr>
            
                              <td>1</td>
            
                              <td>range of binning settings starting from 
                              1</td>        
                                  
                              
          
                              </tr>
      
                              </tbody>
 </informaltable>

I 
                              use docbook-xsl-1.74.0, SAXON, XEP.  I've 
                              tried to do some tweeking with customizations, but 
                              I can't seem to get anything to work.  Thanks 
                              for any help!

Lillian 
                              Sullam
Next in thread → Next in month →