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 Kevin Yeung <ke...@pacific.net.hk> on 2002/07/09 03:55:42 UTC

Re: Nested tables and headers (was: aaaaa) (fwd)

Hi Antonio

Thanks again for the note. Would this work for nested tables of arbitary
depth as well? I couldn't figure out how to write the 3rd (or nth)
level... :(

Thanks & regards
Kevin


>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


__________________________________________________
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) (fwd)

Posted by Antonio Fiol <fi...@w3ping.com>.
Kevin Yeung wrote:

>Hi Antonio
>
>Thanks again for the note. Would this work for nested tables of arbitary
>depth as well? I couldn't figure out how to write the 3rd (or nth)
>level... :(
>
>Thanks & regards
>Kevin
>

Ouch!!!

Well. DO NOT think that what you are generating are nested tables, but a 
SINGLE table with "some bigger cells".

Draw your tables by hand, and think: "How tall will my cell be? (in 
terms of quantity of final unity cells)".

Of course, it is possible to design. You can even mix-up your design, 
and do bizarre things like:

+-------+--------+-------+-------+
| R1C1  |  R1C2  |  R1C3 |  R1C4 |
|       |        |       +-------+
|       |        |       |  R2C4 |
|       |        +-------+       |
|       |        |  R3C3 |       |
|       +--------+       |       |
|       |  R4C2  |       |       |
+-------+        |       |       |
|  R5C1 |        |       |       |
+-------+--------+-------+-------+


Maybe this is no use for you, but you see that every cell is different, 
and this can be achieved by creating a 5-row table, with:
4 cells on 1st row
1 cell on rows 2 to 5
and the number-rows-spanned parameter ranging from 1 (R1C4 and R5C1) to 
4 (R1C1 and R2C4)

I would recommend you to write your table on paper, and count what you need.

Tip: In the example you showed us, you will always be counting the same 
kind of node, but with different conditions. A deeper nest level will 
have MORE conditions than the previous levels. You will also need to 
rework the <xsl:if test="something"> condition.

But, of course, if you can think of it in terms of your data, and define 
it precisely, it is possible ;-)

Antonio Fiol



>>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
>>>      
>>>
>
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Tech - Get in touch with the latest in technology.
>http://sg.tech.yahoo.com
>
>
>
>.
>
>  
>