You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Antonio Fiol <fi...@w3ping.com> on 2002/07/08 11:15:09 UTC

Re: Nested tables and headers (was: aaaaa)

You could take a look at number-rows-spanned, and you would have no need 
for nested tables.

Something like:

<table ...>
 <table-column ... />
 <table-column ... />
 <table-column ... />
 <table-column ... />

 <table-body>
    <table-row>
        <!-- Header row. Put all 4 cells here -->
    </table-row>
    <table-row>
        <table-cell 
number-rows-spanned="2"><block>Bordeaux</block></table-cell>
        <table-cell><block>Pauillac</block>
        <!-- Other cells here -->
    </table-row>
    <table-row>
        <!-- This is the second row for bordeaux -->
        <table-cell><block>StEmilion</block></table-cell>
        <!-- Other cells here -->
    </table-row>
    <!-- Other rows here -->
 </table-body>
</table>

For the argument for number-rows-spanned, if you are using XSLT, you may 
use "{1+count(following-sibling::whatever[Commune=current()/Commune])".

The test for whether to ignore the first column may be:

<xsl:if test="not(preceding-sibling::whatever[Commune=current()/Commune])">
    <table-cell>...</table-cell>
</xsl:if>

HTH,

Antonio Fiol

Kevin Yeung wrote:

>Hi all
>
>I am having a bit of a problem with table header and nested tables. I would like to achieve
>something like this:
>
>+--------------------------------------+
>| Region  | Commune | Variety  | Price |
>+---------+---------+----------+-------+
>|         |Pauillac |Cab Sauv. | High  |
>| Bordeaux+---------+----------+-------+
>|         |StEmilion|  Merlot  | Medium|
>+---------+---------+----------+-------+
>| Burgundy| Chablis |Chardonnay| Medium|
>+---------+---------+----------+-------+
>
>I tried creating an outer table with 2 columns. On the first row, the first column has the text
>"Bordeaux" and the second column has an inner table whose dimension is 3x2 (for the commune and
>variety info). Same for the second row, except the inner table's dimension is 3x1.
>
>The tables get nested properly, but the header is faulty. Since the outer table is defined with
>only 2 columns, I am not able to get 4 header columns as shown above. Instead, only "Region" and
>"Commune" are shown. On the other hand, if I defined the outer table as 4 columns, then "Pauillac,
>Cab Sauv. High" will all go under the second column, with the 3rd and 4th columns empty.
>
>Did I get it all wrong? How should I generate nested tables?
>
>Thank you very much.
>
>Regards
>Kevin Yeung
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Tech - Get in touch with the latest in technology.
>http://sg.tech.yahoo.com
>
>
>
>.
>
>  
>




Re: Nested tables and headers (was: aaaaa)

Posted by Antonio Fiol <fi...@w3ping.com>.
Hi Kevin,

As you see on my example, and especially on the xsl:if thing at the 
bottom, the Bordeaux cell is OMITTED for the second row.

You may try as is. It may work directly.

You told FO that the Bordeaux cell was two rows high, so it may be 
intelligent enough to see that the first cell on the second row is 
actually on the second column.

You may, however, force the column-number attribute to table-cell. See 
the XSL-FO spec at http://www.w3.org/TR/xsl/ . Look for the attribute 
index, and column-number in particular, or look for fo:table-cell, and 
read what is said on it. The spec is an invaluable source of (raw) 
information. I agree it is a bit difficult to cope with, but when one 
gets used to it, many responses come out directly from the spec.


Antonio Fiol



Kevin Yeung wrote:

>Hi Antonio
>
>Thanks for your reply.
>
>For the second row (St Emilion), how many <fo:table-cell> do I have? 3 or 4? If it's 3, how do I
>indicate "StEmilion" aligns with "Pauillac", and not "Bordeaux"? If 4, what do I put for the first
>column?
>
>Thanks a lot.
>
>Regards
>Kevin
>
> --- Antonio Fiol <fi...@w3ping.com> wrote: 
>  
>
>>You could take a look at number-rows-spanned, and you would have no need 
>>for nested tables.
>>
>>Something like:
>>
>><table ...>
>> <table-column ... />
>> <table-column ... />
>> <table-column ... />
>> <table-column ... />
>>
>> <table-body>
>>    <table-row>
>>        <!-- Header row. Put all 4 cells here -->
>>    </table-row>
>>    <table-row>
>>        <table-cell 
>>number-rows-spanned="2"><block>Bordeaux</block></table-cell>
>>        <table-cell><block>Pauillac</block>
>>        <!-- Other cells here -->
>>    </table-row>
>>    <table-row>
>>        <!-- This is the second row for bordeaux -->
>>        <table-cell><block>StEmilion</block></table-cell>
>>        <!-- Other cells here -->
>>    </table-row>
>>    <!-- Other rows here -->
>> </table-body>
>></table>
>>
>>For the argument for number-rows-spanned, if you are using XSLT, you may 
>>use "{1+count(following-sibling::whatever[Commune=current()/Commune])".
>>
>>The test for whether to ignore the first column may be:
>>
>><xsl:if test="not(preceding-sibling::whatever[Commune=current()/Commune])">
>>    <table-cell>...</table-cell>
>></xsl:if>
>>
>>HTH,
>>
>>Antonio Fiol
>>
>>    
>>




Re: Nested tables and headers (was: aaaaa)

Posted by Kevin Yeung <ke...@yahoo.com.sg>.
Hi Antonio

Thanks for your reply.

For the second row (St Emilion), how many <fo:table-cell> do I have? 3 or 4? If it's 3, how do I
indicate "StEmilion" aligns with "Pauillac", and not "Bordeaux"? If 4, what do I put for the first
column?

Thanks a lot.

Regards
Kevin

 --- Antonio Fiol <fi...@w3ping.com> wrote: 
> You could take a look at number-rows-spanned, and you would have no need 
> for nested tables.
> 
> Something like:
> 
> <table ...>
>  <table-column ... />
>  <table-column ... />
>  <table-column ... />
>  <table-column ... />
> 
>  <table-body>
>     <table-row>
>         <!-- Header row. Put all 4 cells here -->
>     </table-row>
>     <table-row>
>         <table-cell 
> number-rows-spanned="2"><block>Bordeaux</block></table-cell>
>         <table-cell><block>Pauillac</block>
>         <!-- Other cells here -->
>     </table-row>
>     <table-row>
>         <!-- This is the second row for bordeaux -->
>         <table-cell><block>StEmilion</block></table-cell>
>         <!-- Other cells here -->
>     </table-row>
>     <!-- Other rows here -->
>  </table-body>
> </table>
> 
> For the argument for number-rows-spanned, if you are using XSLT, you may 
> use "{1+count(following-sibling::whatever[Commune=current()/Commune])".
> 
> The test for whether to ignore the first column may be:
> 
> <xsl:if test="not(preceding-sibling::whatever[Commune=current()/Commune])">
>     <table-cell>...</table-cell>
> </xsl:if>
> 
> HTH,
> 
> Antonio Fiol
> 
> Kevin Yeung wrote:
> 
> >Hi all
> >
> >I am having a bit of a problem with table header and nested tables. I would like to achieve
> >something like this:
> >
> >+--------------------------------------+
> >| Region  | Commune | Variety  | Price |
> >+---------+---------+----------+-------+
> >|         |Pauillac |Cab Sauv. | High  |
> >| Bordeaux+---------+----------+-------+
> >|         |StEmilion|  Merlot  | Medium|
> >+---------+---------+----------+-------+
> >| Burgundy| Chablis |Chardonnay| Medium|
> >+---------+---------+----------+-------+
> >
> >I tried creating an outer table with 2 columns. On the first row, the first column has the text
> >"Bordeaux" and the second column has an inner table whose dimension is 3x2 (for the commune and
> >variety info). Same for the second row, except the inner table's dimension is 3x1.
> >
> >The tables get nested properly, but the header is faulty. Since the outer table is defined with
> >only 2 columns, I am not able to get 4 header columns as shown above. Instead, only "Region"
> and
> >"Commune" are shown. On the other hand, if I defined the outer table as 4 columns, then
> "Pauillac,
> >Cab Sauv. High" will all go under the second column, with the 3rd and 4th columns empty.
> >
> >Did I get it all wrong? How should I generate nested tables?
> >
> >Thank you very much.
> >
> >Regards
> >Kevin Yeung
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Yahoo! Tech - Get in touch with the latest in technology.
> >http://sg.tech.yahoo.com
> >
> >
> >
> >.
> >
> >  
> >
> 
> 
>  

__________________________________________________
Do You Yahoo!?
Yahoo! Tech - Get in touch with the latest in technology.
http://sg.tech.yahoo.com