table-row and sub table-rows problem

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

table-row and sub table-rows problem

David Kim
Hi all,
I want to use second table-row's format as sub
table-row.

I defined two rows with different format.

row1's format is defined in fo:table, it is same
level with table-body or table-header.
           <fo:table-column column-width="0.3cm" />
           <fo:table-column column-width="3.cm" />
           <fo:table-column column-width="3.cm" />
           <fo:table-column column-width="3.cm" />
           <fo:table-column column-width="3.cm" />


ow2's format is defiened under
o:table>fo:table-header>fo:table-row>fo:table-cell>fo:table,..
            <fo:table-column column-width="0.2cm" />
            <fo:table-column column-width="2cm" />
            <fo:table-column column-width="2cm" />
            <fo:table-column column-width="2cm" />


data.xml is like follow:-
      <result>
        <NAME>PAUL3</NAME>
        <REGION>NS</REGION>
        <SALARY>9878787</SALARY>
        <BONUS>1111</BONUS>
        <SUB>
        <REPEAT>
        <SUB1>1111</SUB1>
        <SUB2>2222</SUB2>
        <SUB3>3333</SUB3>
        </REPEAT>
      ............
:--

Title row of table(-row) is working. But I can't use
second table-row format in 'template'.
 'REPEAT' data displayed with row1's format.

How can I use it (with second table-row's format)?
Thanks

David-Toronto-



______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: table-row and sub table-rows problem

Mike Trotman
I'm not sure if I understand your question correctly
(as the xls:fo is chopped / incomplete at crucial points and you don't
show your XSLT)

If you are asking - 'How can I have different column widths for the same
column within the same table'
then you can't (uniform columns is what makes it a table).

You have to use separate tables

OR
specify more columns than you display and combine them differently in
different rows
(using <fo:table-cell  number-columns-spanned='..'>...</fo:table-cell>).
which lets you align specific column boundaries

e.g (gross overkill but I don't want to work out the minimum required
for your example:
- each column width is 0.1cm
and you group 3,30,30,
and then 2,20,20 etc.)

OR (which may be what you are attempting)
have a table cell spanning the whole row and put another table inside
that cell
(which makes it hard to align column boundaries).

HTH

Mike

David Kim wrote:

>Hi all,
>I want to use second table-row's format as sub
>table-row.
>
>I defined two rows with different format.
>
>row1's format is defined in fo:table, it is same
>level with table-body or table-header.
>           <fo:table-column column-width="0.3cm" />
>           <fo:table-column column-width="3.cm" />
>           <fo:table-column column-width="3.cm" />
>           <fo:table-column column-width="3.cm" />
>           <fo:table-column column-width="3.cm" />
>
>
>ow2's format is defiened under
>o:table>fo:table-header>fo:table-row>fo:table-cell>fo:table,..
>    <fo:table-column column-width="0.2cm" />
>    <fo:table-column column-width="2cm" />
>    <fo:table-column column-width="2cm" />
>    <fo:table-column column-width="2cm" />
>
>
>data.xml is like follow:-
>      <result>
>        <NAME>PAUL3</NAME>
>        <REGION>NS</REGION>
>        <SALARY>9878787</SALARY>
>        <BONUS>1111</BONUS>
>        <SUB>
>         <REPEAT>
>         <SUB1>1111</SUB1>
>         <SUB2>2222</SUB2>
>         <SUB3>3333</SUB3>
>         </REPEAT>
>      ............
>:--
>
>Title row of table(-row) is working. But I can't use
>second table-row format in 'template'.
> 'REPEAT' data displayed with row1's format.
>
>How can I use it (with second table-row's format)?
>Thanks
>
>David-Toronto-
>
>
>
>______________________________________________________________________
>Post your free ad now! http://personals.yahoo.ca
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>
>Message Scanned by ClamAV on datalucid.com
>  
>




--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 267.3.0 - Release Date: 30/05/2005


Message Scanned by ClamAV on datalucid.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: table-row and sub table-rows problem

David Kim
In reply to this post by David Kim
Thanks a lot, Mike,
-----------------
1.Expected output
2.xsl file
3.test data xml
-----------------

1. I want my PDF result like follow
|---------|---------|---------|---------| (row1 title)
|------|------|------|  (row2 title)
|---------|---------|---------|---------| (row1)
|---------|---------|---------|---------| (row1)
|------|------|------|                    (row2)
|------|------|------|                    (row2)
|---------|---------|---------|---------| (row1)
|------|------|------|                    (row2)

But current result is like follow
|---------|---------|---------|---------| (row1 title)
|------|------|------|  (row2 title)
|---------|---------|---------|---------| (row1)
|---------|---------|---------|---------| (row1)
|---------|---------|---------|           (row2)
|---------|---------|---------|           (row2)
|---------|---------|---------|---------| (row1)
|---------|---------|---------|           (row2)

2. My xslt is like follow (full)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:fo="http://www.w3.org/1999/XSL/Format"
                exclude-result-prefixes="fo" version="1.1">
  <xsl:template match="data">
    <xsl:value-of select="language" />
   
    <fo:root>
      <fo:layout-master-set>
        <fo:simple-page-master master-name="contents"
margin-top="1cm"
        margin-bottom="1.0581001cm"
margin-left="1cm"
        margin-right="1.0581001cm">
          <fo:region-before
region-name="xsl-region-before" extent="1.7cm" />
          <fo:region-after
region-name="xsl-region-after" extent="1.7cm" />
          <fo:region-start
region-name="xsl-region-start" extent="1.7cm" />
          <fo:region-end region-name="xsl-region-end"
extent="1.7cm" />
          <fo:region-body
region-name="xsl-region-body" margin-top="1.7cm"
          margin-bottom="1.7cm" margin-left="1.7cm"

          margin-right="1.7cm" />
        </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="contents">
        <fo:static-content
flow-name="xsl-region-before">
          <fo:block font-size="13pt">
            <xsl:value-of select="/data/language" />
          </fo:block>
          <fo:block font-family="Times"
font-size="20pt" font-weight="bold"
font-style="italic" text-align="right">
          </fo:block>
        </fo:static-content>
        <fo:static-content
flow-name="xsl-region-after" />
        <fo:static-content
flow-name="xsl-region-start" />
        <fo:static-content flow-name="xsl-region-end"
/>
        <fo:flow flow-name="xsl-region-body">
          <fo:block />
          <fo:block start-indent="3cm"
space-before="2.4cm" font-family="Times"
font-size="37pt" font-weight="bold">
            TITLE
          </fo:block>

          <fo:block>
            <fo:table table-layout="fixed"
width="15cm" background-color="white">
           
            <!--......................-->
            <!--   table-header       -->
            <!--......................-->
              <fo:table-header>
             
              <!--.................. -->
              <!--    table-row 1    -->
              <!--.................. -->
                <fo:table-row height="0.4in">

                  <fo:table-cell border-color="blue"
border-style="solid" border-width="thin">
                    <fo:block font-weight="bold"
font-style="" font-family="Times" font-size="13pt">
                        NAME
                    </fo:block>
                  </fo:table-cell>
                  <fo:table-cell border-color="red"
border-style="solid" border-width="thin">
                    <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
                      REGION
                    </fo:block>
                  </fo:table-cell>
                  <fo:table-cell border-color="green"
border-style="solid" border-width="thin">
                    <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
                      SALARY
                    </fo:block>
                  </fo:table-cell>
                  <fo:table-cell border-color="grey"
border-style="solid" border-width="thin">
                    <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
                      BONUS
                    </fo:block>
                  </fo:table-cell>
                 
                 
                </fo:table-row>
               
               
               
              <!--.................. -->
              <!--    table-row 2    -->
              <!--.................. -->
                <fo:table-row >
                   <fo:table-cell>
                        <!--    ........ooooo..............-->
                               
                        <fo:table table-layout="fixed" width="10cm"
background-color="white">
                       
                          <fo:table-header>
                            <fo:table-row height="0.4in" >
                              <fo:table-cell border-color="blue"
border-style="solid" border-width="thin">
                                <fo:block font-weight="bold" font-style=""
font-family="Times" font-size="13pt">
                                  SUB1
                                </fo:block>
                              </fo:table-cell>
                              <fo:table-cell border-color="red"
border-style="solid" border-width="thin">
                                <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
                                  SUB2
                                </fo:block>
                              </fo:table-cell>
                              <fo:table-cell border-color="green"
border-style="solid" border-width="thin">
                                <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
                                  SUB3
                                </fo:block>
                              </fo:table-cell>
                              </fo:table-row>
                            </fo:table-header>
                           
                           
                            <fo:table-body>  
                              <!-- ** It should be for row2 title **-->
                            </fo:table-body>
                           
                             <!-- ******
.....................................*****-->
                             <!-- ****** I want to use this format later.  
  *****-->
                             <!-- ******
.....................................*****-->

                            <fo:table-column column-width="2cm" />
                            <fo:table-column column-width="2cm" />
                            <fo:table-column column-width="2cm" />
                          </fo:table>
                                                     
                         <!--    ........xxxxx..............-->
                   </fo:table-cell>
                </fo:table-row>

               
              </fo:table-header>
             
            <!--......................-->
            <!--     table-body       -->
            <!--......................-->
             
              <fo:table-body>
               
                <xsl:apply-templates select="//result"
/>

              </fo:table-body>
             
            <!--......................-->
            <!--  table-column-width  -->
            <!--                      -->
            <!--  for data column     -->
            <!--......................-->
             
              <fo:table-column column-width="3.cm" />
              <fo:table-column column-width="3.cm" />
              <fo:table-column column-width="3.cm" />
              <fo:table-column column-width="3.cm" />
             
             
             
             
            </fo:table>
          </fo:block>
          <fo:block id="16491778" />
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </xsl:template>
 
 
  <!-- ***************************** -->
  <!--        template mathch        -->
  <!-- ***************************** -->
  <!-- ............................. -->
  <!--        'result'               -->
  <!-- ............................. -->
 
  <xsl:template
match="result"><!--match=data/body/resultset/result-->
 
 
    <fo:table-row height="0.4in">
     
      <fo:table-cell border-color="red"
border-style="solid" border-width="thin">
        <fo:block font-weight="bold"
font-family="Times" font-size="13pt">
          <xsl:value-of select="NAME" />
        </fo:block>
      </fo:table-cell>
     
      <fo:table-cell border-color="blue"
border-style="solid" border-width="thin">
        <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
          <xsl:value-of select="REGION" />
        </fo:block>
      </fo:table-cell>
     
      <fo:table-cell border-color="grey"
border-style="solid" border-width="thin">
        <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
          <xsl:value-of select="SALARY" />
        </fo:block>
      </fo:table-cell>
     
      <fo:table-cell border-color="green"
border-style="solid" border-width="thin">
        <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
          <xsl:value-of select="BONUS" />
         
        </fo:block>
      </fo:table-cell>
     
     
     
    </fo:table-row>
   
           <xsl:apply-templates select="SUB/REPEAT"/>
   
  </xsl:template>
 
 
   <!-- ............................. -->
   <!--        'REPEAT'               -->
   <!-- ............................. -->
   <xsl:template match="REPEAT" >
   
 <!-- ******
....................................................*****-->
 <!-- ****** I want to use row2 format over here, but
I can't!!! *****-->
 <!-- ****** How can I do. Please let me know that.  
          *****-->
 <!-- ******
....................................................*****-->
 
     <fo:table-row  >
       <fo:table-cell border-color="blue"
border-style="solid" border-width="thin" >
         <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
           <xsl:value-of select="SUB1" />
         </fo:block>
       </fo:table-cell>
       
       <fo:table-cell border-color="grey"
border-style="solid" border-width="thin"  >
         <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
           <xsl:value-of select="SUB2" />
         </fo:block>
       </fo:table-cell>
       
       <fo:table-cell border-color="green"
border-style="solid" border-width="thin" >
         <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
           <xsl:value-of select="SUB3" />
         </fo:block>
       </fo:table-cell>
       
     </fo:table-row>
 
   </xsl:template>
 
</xsl:stylesheet>

3. My test data xml is like follow
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <body>
    <resultset>
      <result>
        <NAME>PAUL3</NAME>
        <REGION>NS</REGION>
        <SALARY>9878787</SALARY>
        <BONUS>1111</BONUS>
        <SUB>
        <REPEAT>
        <SUB1>1111</SUB1>
        <SUB2>2222</SUB2>
        <SUB3>3333</SUB3>
        </REPEAT>
        <REPEAT>
        <SUB1>1111A</SUB1>
        <SUB2>2222A</SUB2>
        <SUB3>3333A</SUB3>
        </REPEAT>
        <REPEAT>
        <SUB1>1111B</SUB1>
        <SUB2>2222B</SUB2>
        <SUB3>3333B</SUB3>
        </REPEAT>
        </SUB>
      </result>
     
      <result>
        <NAME>SubTotal</NAME>
        <REGION />
        <SALARY />
        <BONUS>2222</BONUS>
      </result>
      <result>
        <NAME>PAUL4</NAME>
        <REGION>PEI</REGION>
        <SALARY>98732187</SALARY>
        <BONUS>3333</BONUS>
        <SUB>
                <REPEAT>
                <SUB1>1111C</SUB1>
                <SUB2>2222C</SUB2>
                <SUB3>3333C</SUB3>
                </REPEAT>
                <REPEAT>
                <SUB1>1111D</SUB1>
                <SUB2>2222D</SUB2>
                <SUB3>3333D</SUB3>
                </REPEAT>
                <REPEAT>
                <SUB1>1111E</SUB1>
                <SUB2>2222E</SUB2>
                <SUB3>3333E</SUB3>
                </REPEAT>
        </SUB>

      </result>
      <result>
        <NAME>SubTotal</NAME>
        <REGION />
        <SALARY />
        <BONUS>4444</BONUS>
        <SUB>
        <REPEAT>
        <SUB1>w111</SUB1>
        <SUB2>w222</SUB2>
        <SUB3>w333</SUB3>
        </REPEAT>
        <REPEAT>
        <SUB1>w111A</SUB1>
        <SUB2>w222A</SUB2>
        <SUB3>w333A</SUB3>
        </REPEAT>
        <REPEAT>
        <SUB1>w111B</SUB1>
        <SUB2>w222B</SUB2>
        <SUB3>w333B</SUB3>
        </REPEAT>
        </SUB>
      </result>
      <result>
        <NAME>PAUL5 PAUL5 PAUL5 PAUL5 PAUL5 </NAME>
        <REGION>QUEBEC QUEBEC QUEBEC QUEBEC
QUEBEC</REGION>
        <SALARY>5768787</SALARY>
        <BONUS>5555</BONUS>
        <SUB>
        <REPEAT>
        <SUB1>x111</SUB1>
        <SUB2>x222</SUB2>
        <SUB3>x333</SUB3>
        </REPEAT>
        <REPEAT>
        <SUB1>x111A</SUB1>
        <SUB2>x222A</SUB2>
        <SUB3>x333A</SUB3>
        </REPEAT>
        <REPEAT>
        <SUB1>x111B</SUB1>
        <SUB2>x222B</SUB2>
        <SUB3>x333B</SUB3>
        </REPEAT>
        </SUB>
      </result>
      <result>
        <NAME>SubTotal</NAME>
        <REGION />
        <SALARY />
        <BONUS>6666</BONUS>
        <SUB>
        <REPEAT>
        <SUB1>y111</SUB1>
        <SUB2>y222</SUB2>
        <SUB3>y333</SUB3>
        </REPEAT>
        <REPEAT>
        <SUB1>y111A</SUB1>
        <SUB2>y222A</SUB2>
        <SUB3>y333A</SUB3>
        </REPEAT>
        <REPEAT>
        <SUB1>y111B</SUB1>
        <SUB2>y222B</SUB2>
        <SUB3>y333B</SUB3>
        </REPEAT>
        </SUB>
      </result>
      <result>
        <NAME>SubTotal</NAME>
        <REGION/>
        <SALARY />
        <BONUS>7777</BONUS>
        <SUB>
        <REPEAT>
        <SUB1>z111</SUB1>
        <SUB2>z222</SUB2>
        <SUB3>z333</SUB3>
        </REPEAT>
        <REPEAT>
        <SUB1>z111A</SUB1>
        <SUB2>z222A</SUB2>
        <SUB3>z333A</SUB3>
        </REPEAT>
        <REPEAT>
        <SUB1>z111B</SUB1>
        <SUB2>z222B</SUB2>
        <SUB3>z333B</SUB3>
        </REPEAT>
        </SUB>
      </result>
      <total>
        <BONUS>6578752</BONUS>
      </total>
    </resultset>
  </body>
</data>






--- Mike Trotman <[hidden email]> wrote:

> I'm not sure if I understand your question correctly
> (as the xls:fo is chopped / incomplete at crucial
> points and you don't
> show your XSLT)
>
> If you are asking - 'How can I have different column
> widths for the same
> column within the same table'
> then you can't (uniform columns is what makes it a
> table).
>
> You have to use separate tables
>
> OR
> specify more columns than you display and combine
> them differently in
> different rows
> (using <fo:table-cell
> number-columns-spanned='..'>...</fo:table-cell>).
> which lets you align specific column boundaries
>
> e.g (gross overkill but I don't want to work out the
> minimum required
> for your example:
> - each column width is 0.1cm
> and you group 3,30,30,
> and then 2,20,20 etc.)
>
> OR (which may be what you are attempting)
> have a table cell spanning the whole row and put
> another table inside
> that cell
> (which makes it hard to align column boundaries).
>
> HTH
>
> Mike
>
> David Kim wrote:
>
> >Hi all,
> >I want to use second table-row's format as sub
> >table-row.
> >
> >I defined two rows with different format.
> >
> >row1's format is defined in fo:table, it is same
> >level with table-body or table-header.
> >           <fo:table-column column-width="0.3cm" />
> >           <fo:table-column column-width="3.cm" />
> >           <fo:table-column column-width="3.cm" />
> >           <fo:table-column column-width="3.cm" />
> >           <fo:table-column column-width="3.cm" />
> >
> >
> >ow2's format is defiened under
>
>o:table>fo:table-header>fo:table-row>fo:table-cell>fo:table,..
> >    <fo:table-column column-width="0.2cm" />
> >    <fo:table-column column-width="2cm" />
> >    <fo:table-column column-width="2cm" />
> >    <fo:table-column column-width="2cm" />
> >
> >
> >data.xml is like follow:-
> >      <result>
> >        <NAME>PAUL3</NAME>
> >        <REGION>NS</REGION>
> >        <SALARY>9878787</SALARY>
> >        <BONUS>1111</BONUS>
> >        <SUB>
> >         <REPEAT>
> >         <SUB1>1111</SUB1>
> >         <SUB2>2222</SUB2>
> >         <SUB3>3333</SUB3>
> >         </REPEAT>
> >      ............
> >:--
> >
> >Title row of table(-row) is working. But I can't
> use
> >second table-row format in 'template'.
> > 'REPEAT' data displayed with row1's format.
> >
> >How can I use it (with second table-row's format)?
> >Thanks
> >
> >David-Toronto-
> >
> >
> >
>
>______________________________________________________________________
>
> >Post your free ad now! http://personals.yahoo.ca
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> [hidden email]
> >For additional commands, e-mail:
> [hidden email]
> >
> >
> >Message Scanned by ClamAV on datalucid.com
> >  
> >
>
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.322 / Virus Database: 267.3.0 - Release
> Date: 30/05/2005
>
>
> Message Scanned by ClamAV on datalucid.com
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [hidden email]
> For additional commands, e-mail:
> [hidden email]
>
>

______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: table-row and sub table-rows problem

Mike Trotman
1. For this sort of output I would do Row1 and Row2 as separate tables.

2. But - if you want Row2 to be kept-together with Row1 at page breaks
and / or keep the header repeating over page breaks
then I would put Row2 as a table in a cell spanning the width of the Row
1 table.

3. I would only attempt using lots of 'hidden' columns and complicated,
varying column spans
if it is critical to control the appearance of the joins between the
borders of cells on adjacent Row1 / Row 2 pairs
(and then only if you can;t achieve this effect with the 1st two methods).

So - it looks like you want option 2.

In which case you just need to repeat the table format you have used for
the row 2 title
inside your REPEAT matching template.

You might be able to do this more succinctly (as it looks like this is
what you want)
by setting it up as a named template and calling it with 3 parameters
for the values you want displayed.
(Similarly for Row1 using 4 parameters - but only outputting table-row
and table-cells
without an enclosing redefinition of the table.)

E.g.
<xsl:template name='ROW1'>
<xls:param name='arg1'/>
<xls:param name='arg2'/>
<xls:param name='arg3'/>
<xls:param name='arg4'/>
<fo:table-row>

<fo:table-cell ....>
<fo:block .....>
    <xsl:value-of select='$arg1'/>
</fo:block>
</fo:table-cell>

<fo:table-cell ....>
<fo:block .....>
    <xsl:value-of select='$arg2'/>
</fo:block>
</fo:table-cell>

<fo:table-cell ....>
<fo:block .....>
    <xsl:value-of select='$arg3'/>
</fo:block>
</fo:table-cell>

<fo:table-cell ....>
<fo:block .....>
    <xsl:value-of select='$arg4'/>
</fo:block>
</fo:table-cell>

</fo:table-row>
</xsl:template>

and a similar one for but including a full table definition
<xsl:template name='REPEAT'>
<xls:param name='arg1'/>
<xls:param name='arg2'/>
<xls:param name='arg3'/>

<fo:table-row>
<fo:table-cell number-columns-spanned='4'>
<fo:block>

<!-- and now the table inside the cell -->
<fo:table>
<fo:table-column column-width="2cm" />
<fo:table-column column-width="2cm" />
<fo:table-column column-width="2cm" />
<fo:table-row>
<fo:table-cell ...><fo:block....><xsl:value-of
select='$arg1'/></fo:block></fo:table-cell>
<fo:table-cell ...><fo:block....><xsl:value-of
select='$arg2'/></fo:block></fo:table-cell>
<fo:table-cell ...><fo:block....><xsl:value-of
select='$arg3'/></fo:block></fo:table-cell>
</fo:table-row>
</fo:table>

<!-- end of included table -->
</fo:block>
</fo:table-cell>
</fo:table-row>

</xsl:template>


And then set up you main table based on ROW 1

and when you need to produce your title row

<xsl:call-template name='ROW1'>
    <xsl:with-param name='arg1' select='"NAME"'/>
    <xsl:with-param name='arg1' select='"REGION"'/>
    <xsl:with-param name='arg1' select='"SALARY"'/>
    <xsl:with-param name='arg1' select='"BONUS"'/>
</xsl:call-template.

Similarly for REPEAT row titles using REPEAT template
<xsl:call-template name='REPEAT'>
    <xsl:with-param name='arg1' select='"SUB1"'/>
    <xsl:with-param name='arg1' select='"SUB2"'/>
    <xsl:with-param name='arg1' select='"SUB3"'/>
</xsl:call-template.

and when you need to produce you Row1 type row
(parent elements included for clarity)
<xsl:call-template name='ROW1'>
    <xsl:with-param name='arg1' select='result/NAME'/>
    <xsl:with-param name='arg2' select='result/REGION'/>
    <xsl:with-param name='arg3' select='"result/SALARY"'/>
    <xsl:with-param name='arg4' select='"result/BONUS"'/>
</xsl:call-template>

and to produce the row for your SUB/REPEAT
<xsl:call-template name='REPEAT'>
    <xsl:with-param name='arg1' select='REPEAT/.SUB1'/>
    <xsl:with-param name='arg2' select='REPEAT/SUB2/>
    <xsl:with-param name='arg3' select='"REPEAT/SUB3"'/>
</xsl:call-template>


Sorry if that's a little laborious - I wasn't sure how much help you needed.


Mike


David Kim wrote:

>Thanks a lot, Mike,
>-----------------
>1.Expected output
>2.xsl file
>3.test data xml
>-----------------
>
>1. I want my PDF result like follow
>|---------|---------|---------|---------| (row1 title)
>|------|------|------|  (row2 title)
>|---------|---------|---------|---------| (row1)
>|---------|---------|---------|---------| (row1)
>|------|------|------|                    (row2)
>|------|------|------|                    (row2)
>|---------|---------|---------|---------| (row1)
>|------|------|------|                    (row2)
>
>But current result is like follow
>|---------|---------|---------|---------| (row1 title)
>|------|------|------|  (row2 title)
>|---------|---------|---------|---------| (row1)
>|---------|---------|---------|---------| (row1)
>|---------|---------|---------|           (row2)
>|---------|---------|---------|           (row2)
>|---------|---------|---------|---------| (row1)
>|---------|---------|---------|           (row2)
>
>2. My xslt is like follow (full)
><?xml version="1.0" encoding="UTF-8"?>
><xsl:stylesheet
>xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:fo="http://www.w3.org/1999/XSL/Format"
> exclude-result-prefixes="fo" version="1.1">
>  <xsl:template match="data">
>    <xsl:value-of select="language" />
>    
>    <fo:root>
>      <fo:layout-master-set>
>        <fo:simple-page-master master-name="contents"
>margin-top="1cm"
>         margin-bottom="1.0581001cm"
>margin-left="1cm"
>         margin-right="1.0581001cm">
>          <fo:region-before
>region-name="xsl-region-before" extent="1.7cm" />
>          <fo:region-after
>region-name="xsl-region-after" extent="1.7cm" />
>          <fo:region-start
>region-name="xsl-region-start" extent="1.7cm" />
>          <fo:region-end region-name="xsl-region-end"
>extent="1.7cm" />
>          <fo:region-body
>region-name="xsl-region-body" margin-top="1.7cm"
>           margin-bottom="1.7cm" margin-left="1.7cm"
>
>           margin-right="1.7cm" />
>        </fo:simple-page-master>
>      </fo:layout-master-set>
>      <fo:page-sequence master-reference="contents">
>        <fo:static-content
>flow-name="xsl-region-before">
>          <fo:block font-size="13pt">
>            <xsl:value-of select="/data/language" />
>          </fo:block>
>          <fo:block font-family="Times"
>font-size="20pt" font-weight="bold"
>font-style="italic" text-align="right">
>          </fo:block>
>        </fo:static-content>
>        <fo:static-content
>flow-name="xsl-region-after" />
>        <fo:static-content
>flow-name="xsl-region-start" />
>        <fo:static-content flow-name="xsl-region-end"
>/>
>        <fo:flow flow-name="xsl-region-body">
>          <fo:block />
>          <fo:block start-indent="3cm"
>space-before="2.4cm" font-family="Times"
>font-size="37pt" font-weight="bold">
>            TITLE
>          </fo:block>
>
>          <fo:block>
>            <fo:table table-layout="fixed"
>width="15cm" background-color="white">
>            
>            <!--......................-->
>            <!--   table-header       -->
>            <!--......................-->
>              <fo:table-header>
>              
>               <!--.................. -->
>               <!--    table-row 1    -->
>               <!--.................. -->
>                <fo:table-row height="0.4in">
>
>                  <fo:table-cell border-color="blue"
>border-style="solid" border-width="thin">
>                    <fo:block font-weight="bold"
>font-style="" font-family="Times" font-size="13pt">
> NAME
>    </fo:block>
>                  </fo:table-cell>
>                  <fo:table-cell border-color="red"
>border-style="solid" border-width="thin">
>                    <fo:block font-weight="bold"
>font-style="italic" font-family="Times"
>font-size="13pt">
>                      REGION
>                    </fo:block>
>                  </fo:table-cell>
>                  <fo:table-cell border-color="green"
>border-style="solid" border-width="thin">
>                    <fo:block font-weight="bold"
>font-style="italic" font-family="Times"
>font-size="13pt">
>                      SALARY
>                    </fo:block>
>                  </fo:table-cell>
>                  <fo:table-cell border-color="grey"
>border-style="solid" border-width="thin">
>                    <fo:block font-weight="bold"
>font-style="italic" font-family="Times"
>font-size="13pt">
>                      BONUS
>                    </fo:block>
>                  </fo:table-cell>
>                  
>                  
>                </fo:table-row>
>                
>                
>                
>               <!--.................. -->
>               <!--    table-row 2    -->
>               <!--.................. -->
>                <fo:table-row >
>   <fo:table-cell>
>        <!--    ........ooooo..............-->
>        
> <fo:table table-layout="fixed" width="10cm"
>background-color="white">
>
>  <fo:table-header>
>    <fo:table-row height="0.4in" >
>      <fo:table-cell border-color="blue"
>border-style="solid" border-width="thin">
>        <fo:block font-weight="bold" font-style=""
>font-family="Times" font-size="13pt">
>          SUB1
>        </fo:block>
>      </fo:table-cell>
>      <fo:table-cell border-color="red"
>border-style="solid" border-width="thin">
>        <fo:block font-weight="bold"
>font-style="italic" font-family="Times"
>font-size="13pt">
>          SUB2
>        </fo:block>
>      </fo:table-cell>
>      <fo:table-cell border-color="green"
>border-style="solid" border-width="thin">
>        <fo:block font-weight="bold"
>font-style="italic" font-family="Times"
>font-size="13pt">
>          SUB3
>        </fo:block>
>      </fo:table-cell>
>      </fo:table-row>
>    </fo:table-header>
>    
>    
>    <fo:table-body>  
>      <!-- ** It should be for row2 title **-->
>    </fo:table-body>
>  
>     <!-- ******
>.....................................*****-->
>     <!-- ****** I want to use this format later.  
>  *****-->
>     <!-- ******
>.....................................*****-->
>
>    <fo:table-column column-width="2cm" />
>    <fo:table-column column-width="2cm" />
>    <fo:table-column column-width="2cm" />
>  </fo:table>
>                      
> <!--    ........xxxxx..............-->
>   </fo:table-cell>
> </fo:table-row>
>
>              
>              </fo:table-header>
>              
>            <!--......................-->
>            <!--     table-body       -->
>            <!--......................-->
>              
>              <fo:table-body>
>              
>                <xsl:apply-templates select="//result"
>/>
>
>              </fo:table-body>
>              
>            <!--......................-->
>            <!--  table-column-width  -->
>            <!--                      -->
>            <!--  for data column     -->
>            <!--......................-->
>              
>              <fo:table-column column-width="3.cm" />
>              <fo:table-column column-width="3.cm" />
>              <fo:table-column column-width="3.cm" />
>              <fo:table-column column-width="3.cm" />
>              
>              
>              
>              
>            </fo:table>
>          </fo:block>
>          <fo:block id="16491778" />
>        </fo:flow>
>      </fo:page-sequence>
>    </fo:root>
>  </xsl:template>
>  
>  
>  <!-- ***************************** -->
>  <!--        template mathch        -->
>  <!-- ***************************** -->
>  <!-- ............................. -->
>  <!--        'result'               -->
>  <!-- ............................. -->
>  
>  <xsl:template
>match="result"><!--match=data/body/resultset/result-->
>  
>  
>    <fo:table-row height="0.4in">
>      
>      <fo:table-cell border-color="red"
>border-style="solid" border-width="thin">
>        <fo:block font-weight="bold"
>font-family="Times" font-size="13pt">
>          <xsl:value-of select="NAME" />
>        </fo:block>
>      </fo:table-cell>
>      
>      <fo:table-cell border-color="blue"
>border-style="solid" border-width="thin">
>        <fo:block font-weight="bold"
>font-style="italic" font-family="Times"
>font-size="13pt">
>          <xsl:value-of select="REGION" />
>        </fo:block>
>      </fo:table-cell>
>      
>      <fo:table-cell border-color="grey"
>border-style="solid" border-width="thin">
>        <fo:block font-weight="bold"
>font-style="italic" font-family="Times"
>font-size="13pt">
>          <xsl:value-of select="SALARY" />
>        </fo:block>
>      </fo:table-cell>
>      
>      <fo:table-cell border-color="green"
>border-style="solid" border-width="thin">
>        <fo:block font-weight="bold"
>font-style="italic" font-family="Times"
>font-size="13pt">
>          <xsl:value-of select="BONUS" />
>          
>        </fo:block>
>      </fo:table-cell>
>      
>      
>      
>    </fo:table-row>
>    
>           <xsl:apply-templates select="SUB/REPEAT"/>
>    
>  </xsl:template>
>  
>
>   <!-- ............................. -->
>   <!--        'REPEAT'               -->
>   <!-- ............................. -->
>   <xsl:template match="REPEAT" >
>  
> <!-- ******
>....................................................*****-->
> <!-- ****** I want to use row2 format over here, but
>I can't!!! *****-->
> <!-- ****** How can I do. Please let me know that.  
>          *****-->
> <!-- ******
>....................................................*****-->
>
>     <fo:table-row  >
>       <fo:table-cell border-color="blue"
>border-style="solid" border-width="thin" >
>         <fo:block font-weight="bold"
>font-style="italic" font-family="Times"
>font-size="13pt">
>           <xsl:value-of select="SUB1" />
>         </fo:block>
>       </fo:table-cell>
>      
>       <fo:table-cell border-color="grey"
>border-style="solid" border-width="thin"  >
>         <fo:block font-weight="bold"
>font-style="italic" font-family="Times"
>font-size="13pt">
>           <xsl:value-of select="SUB2" />
>         </fo:block>
>       </fo:table-cell>
>      
>       <fo:table-cell border-color="green"
>border-style="solid" border-width="thin" >
>         <fo:block font-weight="bold"
>font-style="italic" font-family="Times"
>font-size="13pt">
>           <xsl:value-of select="SUB3" />
>         </fo:block>
>       </fo:table-cell>
>      
>     </fo:table-row>
>
>   </xsl:template>
>
></xsl:stylesheet>
>
>3. My test data xml is like follow
><?xml version="1.0" encoding="UTF-8"?>
><data>
>  <body>
>    <resultset>
>      <result>
>        <NAME>PAUL3</NAME>
>        <REGION>NS</REGION>
>        <SALARY>9878787</SALARY>
>        <BONUS>1111</BONUS>
>        <SUB>
>         <REPEAT>
>         <SUB1>1111</SUB1>
>         <SUB2>2222</SUB2>
>         <SUB3>3333</SUB3>
>         </REPEAT>
>         <REPEAT>
>         <SUB1>1111A</SUB1>
>         <SUB2>2222A</SUB2>
>         <SUB3>3333A</SUB3>
>         </REPEAT>
>         <REPEAT>
>         <SUB1>1111B</SUB1>
>         <SUB2>2222B</SUB2>
>         <SUB3>3333B</SUB3>
>         </REPEAT>
>        </SUB>
>      </result>
>      
>      <result>
>        <NAME>SubTotal</NAME>
>        <REGION />
>        <SALARY />
>        <BONUS>2222</BONUS>
>      </result>
>      <result>
>        <NAME>PAUL4</NAME>
>        <REGION>PEI</REGION>
>        <SALARY>98732187</SALARY>
>        <BONUS>3333</BONUS>
>        <SUB>
>        <REPEAT>
>         <SUB1>1111C</SUB1>
>         <SUB2>2222C</SUB2>
>         <SUB3>3333C</SUB3>
>        </REPEAT>
>        <REPEAT>
>         <SUB1>1111D</SUB1>
>         <SUB2>2222D</SUB2>
>         <SUB3>3333D</SUB3>
>        </REPEAT>
>        <REPEAT>
>         <SUB1>1111E</SUB1>
>         <SUB2>2222E</SUB2>
>         <SUB3>3333E</SUB3>
>        </REPEAT>
> </SUB>
>
>      </result>
>      <result>
>        <NAME>SubTotal</NAME>
>        <REGION />
>        <SALARY />
>        <BONUS>4444</BONUS>
>        <SUB>
>         <REPEAT>
>         <SUB1>w111</SUB1>
>         <SUB2>w222</SUB2>
>         <SUB3>w333</SUB3>
>         </REPEAT>
>         <REPEAT>
>         <SUB1>w111A</SUB1>
>         <SUB2>w222A</SUB2>
>         <SUB3>w333A</SUB3>
>         </REPEAT>
>         <REPEAT>
>         <SUB1>w111B</SUB1>
>         <SUB2>w222B</SUB2>
>         <SUB3>w333B</SUB3>
>         </REPEAT>
>        </SUB>
>      </result>
>      <result>
>        <NAME>PAUL5 PAUL5 PAUL5 PAUL5 PAUL5 </NAME>
>        <REGION>QUEBEC QUEBEC QUEBEC QUEBEC
>QUEBEC</REGION>
>        <SALARY>5768787</SALARY>
>        <BONUS>5555</BONUS>
>        <SUB>
>         <REPEAT>
>         <SUB1>x111</SUB1>
>         <SUB2>x222</SUB2>
>         <SUB3>x333</SUB3>
>         </REPEAT>
>         <REPEAT>
>         <SUB1>x111A</SUB1>
>         <SUB2>x222A</SUB2>
>         <SUB3>x333A</SUB3>
>         </REPEAT>
>         <REPEAT>
>         <SUB1>x111B</SUB1>
>         <SUB2>x222B</SUB2>
>         <SUB3>x333B</SUB3>
>         </REPEAT>
>        </SUB>
>      </result>
>      <result>
>        <NAME>SubTotal</NAME>
>        <REGION />
>        <SALARY />
>        <BONUS>6666</BONUS>
>        <SUB>
>         <REPEAT>
>         <SUB1>y111</SUB1>
>         <SUB2>y222</SUB2>
>         <SUB3>y333</SUB3>
>         </REPEAT>
>         <REPEAT>
>         <SUB1>y111A</SUB1>
>         <SUB2>y222A</SUB2>
>         <SUB3>y333A</SUB3>
>         </REPEAT>
>         <REPEAT>
>         <SUB1>y111B</SUB1>
>         <SUB2>y222B</SUB2>
>         <SUB3>y333B</SUB3>
>         </REPEAT>
>        </SUB>
>      </result>
>      <result>
>        <NAME>SubTotal</NAME>
>        <REGION/>
>        <SALARY />
>        <BONUS>7777</BONUS>
>        <SUB>
>         <REPEAT>
>         <SUB1>z111</SUB1>
>         <SUB2>z222</SUB2>
>         <SUB3>z333</SUB3>
>         </REPEAT>
>         <REPEAT>
>         <SUB1>z111A</SUB1>
>         <SUB2>z222A</SUB2>
>         <SUB3>z333A</SUB3>
>         </REPEAT>
>         <REPEAT>
>         <SUB1>z111B</SUB1>
>         <SUB2>z222B</SUB2>
>         <SUB3>z333B</SUB3>
>         </REPEAT>
>        </SUB>
>      </result>
>      <total>
>        <BONUS>6578752</BONUS>
>      </total>
>    </resultset>
>  </body>
></data>
>
>
>
>
>
>
>--- Mike Trotman <[hidden email]> wrote:
>  
>
>>I'm not sure if I understand your question correctly
>>(as the xls:fo is chopped / incomplete at crucial
>>points and you don't
>>show your XSLT)
>>
>>If you are asking - 'How can I have different column
>>widths for the same
>>column within the same table'
>>then you can't (uniform columns is what makes it a
>>table).
>>
>>You have to use separate tables
>>
>>OR
>>specify more columns than you display and combine
>>them differently in
>>different rows
>>(using <fo:table-cell
>>number-columns-spanned='..'>...</fo:table-cell>).
>>which lets you align specific column boundaries
>>
>>e.g (gross overkill but I don't want to work out the
>>minimum required
>>for your example:
>>- each column width is 0.1cm
>>and you group 3,30,30,
>>and then 2,20,20 etc.)
>>
>>OR (which may be what you are attempting)
>>have a table cell spanning the whole row and put
>>another table inside
>>that cell
>>(which makes it hard to align column boundaries).
>>
>>HTH
>>
>>Mike
>>
>>David Kim wrote:
>>
>>    
>>
>>>Hi all,
>>>I want to use second table-row's format as sub
>>>table-row.
>>>
>>>I defined two rows with different format.
>>>
>>>row1's format is defined in fo:table, it is same
>>>level with table-body or table-header.
>>>          <fo:table-column column-width="0.3cm" />
>>>          <fo:table-column column-width="3.cm" />
>>>          <fo:table-column column-width="3.cm" />
>>>          <fo:table-column column-width="3.cm" />
>>>          <fo:table-column column-width="3.cm" />
>>>
>>>
>>>ow2's format is defiened under
>>>      
>>>
>>o:table>fo:table-header>fo:table-row>fo:table-cell>fo:table,..
>>    
>>
>>>    <fo:table-column column-width="0.2cm" />
>>>    <fo:table-column column-width="2cm" />
>>>    <fo:table-column column-width="2cm" />
>>>    <fo:table-column column-width="2cm" />
>>>
>>>
>>>data.xml is like follow:-
>>>     <result>
>>>       <NAME>PAUL3</NAME>
>>>       <REGION>NS</REGION>
>>>       <SALARY>9878787</SALARY>
>>>       <BONUS>1111</BONUS>
>>>       <SUB>
>>>       <REPEAT>
>>>       <SUB1>1111</SUB1>
>>>       <SUB2>2222</SUB2>
>>>       <SUB3>3333</SUB3>
>>>       </REPEAT>
>>>     ............
>>>:--
>>>
>>>Title row of table(-row) is working. But I can't
>>>      
>>>
>>use
>>    
>>
>>>second table-row format in 'template'.
>>>'REPEAT' data displayed with row1's format.
>>>
>>>How can I use it (with second table-row's format)?
>>>Thanks
>>>
>>>David-Toronto-
>>>
>>>
>>>
>>>      
>>>
>>______________________________________________________________________
>>
>>    
>>
>>>Post your free ad now! http://personals.yahoo.ca
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>    
>>
>>>To unsubscribe, e-mail:
>>>      
>>>
>>[hidden email]
>>    
>>
>>>For additional commands, e-mail:
>>>      
>>>
>>[hidden email]
>>    
>>
>>>Message Scanned by ClamAV on datalucid.com
>>>
>>>
>>>      
>>>
>>
>>
>>--
>>No virus found in this outgoing message.
>>Checked by AVG Anti-Virus.
>>Version: 7.0.322 / Virus Database: 267.3.0 - Release
>>Date: 30/05/2005
>>
>>
>>Message Scanned by ClamAV on datalucid.com
>>
>>
>>    
>>
>---------------------------------------------------------------------
>  
>
>>To unsubscribe, e-mail:
>>[hidden email]
>>For additional commands, e-mail:
>>[hidden email]
>>
>>
>>    
>>
>
>______________________________________________________________________
>Post your free ad now! http://personals.yahoo.ca
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>
>Message Scanned by ClamAV on datalucid.com
>  
>




--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 267.3.0 - Release Date: 30/05/2005


Message Scanned by ClamAV on datalucid.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: table-row and sub table-rows problem:SUCCESS! and one more.

David Kim
Mike, You are right! I got a good result that I wanted
exactly.
I put a table in '<xsl:template match="SUB/REPEAT" >'
as you said, and I got it.
I tested it several times and I was able to get simple
change.
<xsl:template match="SUB/REPEAT" > is only one thing
changed as follow,

-------follow start-------------------------------
   <!-- ............................. -->
   <!--        'REPEAT'               -->
   <!-- ............................. -->
   <xsl:template match="SUB/REPEAT" >

        <fo:table-row>

        <fo:table-cell number-columns-spanned='3'>
        <fo:block>

                <!-- and now the table inside the cell -->
                <fo:table>
                <fo:table-column column-width="2cm" />
                <fo:table-column column-width="2cm" />
                <fo:table-column column-width="2cm" />
 
  <fo:table-body> <!-- ** %% Not header %% ** -->
      <fo:table-row  height="0.2in">
     
        <fo:table-cell border-color="blue"
border-style="solid" border-width="thin" >
        <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
          <xsl:value-of select="SUB1" />
        </fo:block>
        </fo:table-cell>
       
        <fo:table-cell border-color="grey"
border-style="solid" border-width="thin"  >
        <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
          <xsl:value-of select="SUB2" />
        </fo:block>
        </fo:table-cell>
       
        <fo:table-cell border-color="green"
border-style="solid" border-width="thin" >
        <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
          <xsl:value-of select="SUB3" />
        </fo:block>
        </fo:table-cell>
       
       
      </fo:table-row>
  </fo:table-body>
                </fo:table>

                <!-- end of included table -->

        </fo:block>
        </fo:table-cell>
        </fo:table-row>

 
   </xsl:template>
-------follow end-------------------------------

I did one more try. I tried to get sub title as follow
I think this try is your first suggestion(Using
seperate tables).

CASE 2


Current result is follow (SUCCESS! first test case)
|---------|---------|---------|---------| (row1 title)
|------|------|------|  (row2 title)
|---------|---------|---------|---------| (row1)
|---------|---------|---------|---------| (row1)
|------|------|------|                    (row2)
|------|------|------|                    (row2)
|---------|---------|---------|---------| (row1)
|------|------|------|                    (row2)


I want this type table  (ONE MORE added.)
|---------|---------|---------|---------| (row1 title)
|------|------|------|  (row2 title)
|---------|---------|---------|---------| (row1)
|---------|---------|---------|---------| (row1)
|------|------|------|  (row2 title)
|------|------|------|                    (row2)
|------|------|------|                    (row2)
|---------|---------|---------|---------| (row1)
|------|------|------|  (row2 title)
|------|------|------|                    (row2)

or,

|---------|---------|---------|---------| (row1 title)
|------|------|------|  (row2 title)
|---------|---------|---------|---------| (row1)
|---------|---------|---------|---------| (row1)

|------|------|------|  (row2 title)
|------|------|------|                    (row2)
|------|------|------|                    (row2)

|---------|---------|---------|---------| (row1)

|------|------|------|  (row2 title)
|------|------|------|                    (row2)


I tried but result is follow (I put the title in
sub-table in "SUB/REPEAT" template)
|---------|---------|---------|---------| (row1 title)
|------|------|------|  (row2 title)
|---------|---------|---------|---------| (row1)
|---------|---------|---------|---------| (row1)
|------|------|------|  (row2 title)
|------|------|------|                    (row2)
|------|------|------|  (row2 title)
|------|------|------|                    (row2)
|---------|---------|---------|---------| (row1)
|------|------|------|  (row2 title)
|------|------|------|                    (row2)
Please lead me.
Thank you for your good help

--- Mike Trotman <[hidden email]> wrote:

> 1. For this sort of output I would do Row1 and Row2
> as separate tables.
>
> 2. But - if you want Row2 to be kept-together with
> Row1 at page breaks
> and / or keep the header repeating over page breaks
> then I would put Row2 as a table in a cell spanning
> the width of the Row
> 1 table.
>
> 3. I would only attempt using lots of 'hidden'
> columns and complicated,
> varying column spans
> if it is critical to control the appearance of the
> joins between the
> borders of cells on adjacent Row1 / Row 2 pairs
> (and then only if you can;t achieve this effect with
> the 1st two methods).
>
> So - it looks like you want option 2.
>
> In which case you just need to repeat the table
> format you have used for
> the row 2 title
> inside your REPEAT matching template.
>
> You might be able to do this more succinctly (as it
> looks like this is
> what you want)
> by setting it up as a named template and calling it
> with 3 parameters
> for the values you want displayed.
> (Similarly for Row1 using 4 parameters - but only
> outputting table-row
> and table-cells
> without an enclosing redefinition of the table.)
>
> E.g.
> <xsl:template name='ROW1'>
> <xls:param name='arg1'/>
> <xls:param name='arg2'/>
> <xls:param name='arg3'/>
> <xls:param name='arg4'/>
> <fo:table-row>
>
> <fo:table-cell ....>
> <fo:block .....>
>     <xsl:value-of select='$arg1'/>
> </fo:block>
> </fo:table-cell>
>
> <fo:table-cell ....>
> <fo:block .....>
>     <xsl:value-of select='$arg2'/>
> </fo:block>
> </fo:table-cell>
>
> <fo:table-cell ....>
> <fo:block .....>
>     <xsl:value-of select='$arg3'/>
> </fo:block>
> </fo:table-cell>
>
> <fo:table-cell ....>
> <fo:block .....>
>     <xsl:value-of select='$arg4'/>
> </fo:block>
> </fo:table-cell>
>
> </fo:table-row>
> </xsl:template>
>
> and a similar one for but including a full table
> definition
> <xsl:template name='REPEAT'>
> <xls:param name='arg1'/>
> <xls:param name='arg2'/>
> <xls:param name='arg3'/>
>
> <fo:table-row>
> <fo:table-cell number-columns-spanned='4'>
> <fo:block>
>
> <!-- and now the table inside the cell -->
> <fo:table>
> <fo:table-column column-width="2cm" />
> <fo:table-column column-width="2cm" />
> <fo:table-column column-width="2cm" />
> <fo:table-row>
> <fo:table-cell ...><fo:block....><xsl:value-of
> select='$arg1'/></fo:block></fo:table-cell>
> <fo:table-cell ...><fo:block....><xsl:value-of
> select='$arg2'/></fo:block></fo:table-cell>
> <fo:table-cell ...><fo:block....><xsl:value-of
> select='$arg3'/></fo:block></fo:table-cell>
> </fo:table-row>
> </fo:table>
>
> <!-- end of included table -->
> </fo:block>
> </fo:table-cell>
> </fo:table-row>
>
> </xsl:template>
>
>
> And then set up you main table based on ROW 1
>
> and when you need to produce your title row
>
> <xsl:call-template name='ROW1'>
>     <xsl:with-param name='arg1' select='"NAME"'/>
>     <xsl:with-param name='arg1' select='"REGION"'/>
>     <xsl:with-param name='arg1' select='"SALARY"'/>
>     <xsl:with-param name='arg1' select='"BONUS"'/>
> </xsl:call-template.
>
> Similarly for REPEAT row titles using REPEAT
> template
> <xsl:call-template name='REPEAT'>
>     <xsl:with-param name='arg1' select='"SUB1"'/>
>     <xsl:with-param name='arg1' select='"SUB2"'/>
>     <xsl:with-param name='arg1' select='"SUB3"'/>
> </xsl:call-template.
>
> and when you need to produce you Row1 type row
> (parent elements included for clarity)
> <xsl:call-template name='ROW1'>
>     <xsl:with-param name='arg1'
> select='result/NAME'/>
>     <xsl:with-param name='arg2'
> select='result/REGION'/>
>     <xsl:with-param name='arg3'
> select='"result/SALARY"'/>
>     <xsl:with-param name='arg4'
> select='"result/BONUS"'/>
> </xsl:call-template>
>
> and to produce the row for your SUB/REPEAT
> <xsl:call-template name='REPEAT'>
>     <xsl:with-param name='arg1'
> select='REPEAT/.SUB1'/>
>     <xsl:with-param name='arg2'
> select='REPEAT/SUB2/>
>     <xsl:with-param name='arg3'
> select='"REPEAT/SUB3"'/>
> </xsl:call-template>
>
>
> Sorry if that's a little laborious - I wasn't sure
> how much help you needed.
>
>
> Mike
>
>
> David Kim wrote:
>
> >Thanks a lot, Mike,
> >-----------------
> >1.Expected output
> >2.xsl file
> >3.test data xml
> >-----------------
> >
> >1. I want my PDF result like follow
> >|---------|---------|---------|---------| (row1
> title)
> >|------|------|------|  (row2 title)
> >|---------|---------|---------|---------| (row1)
> >|---------|---------|---------|---------| (row1)
> >|------|------|------|                    (row2)
> >|------|------|------|                    (row2)
> >|---------|---------|---------|---------| (row1)
> >|------|------|------|                    (row2)
> >
> >But current result is like follow
> >|---------|---------|---------|---------| (row1
> title)
> >|------|------|------|  (row2 title)
> >|---------|---------|---------|---------| (row1)
> >|---------|---------|---------|---------| (row1)
> >|---------|---------|---------|           (row2)
> >|---------|---------|---------|           (row2)
> >|---------|---------|---------|---------| (row1)
> >|---------|---------|---------|           (row2)
> >
> >2. My xslt is like follow (full)
> ><?xml version="1.0" encoding="UTF-8"?>
> ><xsl:stylesheet
> >xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > xmlns:fo="http://www.w3.org/1999/XSL/Format"
> > exclude-result-prefixes="fo" version="1.1">
> >  <xsl:template match="data">
> >    <xsl:value-of select="language" />
> >    
> >    <fo:root>
> >      <fo:layout-master-set>
> >        <fo:simple-page-master
> master-name="contents"
> >margin-top="1cm"
>
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: table-row and sub table-rows problem:SUCCESS! and one more.

Mike Trotman
Hi David.

Various ways of doing this.

Simplest change to your existing code is probably to insert an <xsl:if>
block in your current SUB/REPEAT template match
around the code for the title row.

To get the title on just the 1st 'ROW2' you would need to test that
there are no other REPEATs immediately before (i.e. this is the 1st)
so the IF would be something like

<xsl:if test='not(preceding-sibling::REPEAT[1])'>
<fo:table-row ...>
... and then the <fo:table-cell>s for your titles
</fo:table-row>
</xsl:if>

Also see below for where to insert this.


Mike

David Kim wrote:

>Mike, You are right! I got a good result that I wanted
>exactly.
>I put a table in '<xsl:template match="SUB/REPEAT" >'
>as you said, and I got it.
>I tested it several times and I was able to get simple
>change.
><xsl:template match="SUB/REPEAT" > is only one thing
>changed as follow,
>
>-------follow start-------------------------------
>   <!-- ............................. -->
>   <!--        'REPEAT'               -->
>   <!-- ............................. -->
>   <xsl:template match="SUB/REPEAT" >
>
> <fo:table-row>
>
> <fo:table-cell number-columns-spanned='3'>
> <fo:block>
>
> <!-- and now the table inside the cell -->
> <fo:table>
> <fo:table-column column-width="2cm" />
> <fo:table-column column-width="2cm" />
> <fo:table-column column-width="2cm" />
>
> <fo:table-body> <!-- ** %% Not header %% ** -->
>  
>
INSERT THE <XSL:IF> HERE

>     <fo:table-row  height="0.2in">
>    
>       <fo:table-cell border-color="blue"
>border-style="solid" border-width="thin" >
>         <fo:block font-weight="bold"
>font-style="italic" font-family="Times"
>font-size="13pt">
>           <xsl:value-of select="SUB1" />
>         </fo:block>
>       </fo:table-cell>
>      
>       <fo:table-cell border-color="grey"
>border-style="solid" border-width="thin"  >
>         <fo:block font-weight="bold"
>font-style="italic" font-family="Times"
>font-size="13pt">
>           <xsl:value-of select="SUB2" />
>         </fo:block>
>       </fo:table-cell>
>      
>       <fo:table-cell border-color="green"
>border-style="solid" border-width="thin" >
>         <fo:block font-weight="bold"
>font-style="italic" font-family="Times"
>font-size="13pt">
>           <xsl:value-of select="SUB3" />
>         </fo:block>
>       </fo:table-cell>
>      
>      
>     </fo:table-row>
> </fo:table-body>
> </fo:table>
>
> <!-- end of included table -->
>
> </fo:block>
> </fo:table-cell>
> </fo:table-row>
>
>
>   </xsl:template>
>-------follow end-------------------------------
>
>I did one more try. I tried to get sub title as follow
>I think this try is your first suggestion(Using
>seperate tables).
>
>CASE 2
>
>
>Current result is follow (SUCCESS! first test case)
>|---------|---------|---------|---------| (row1 title)
>|------|------|------|  (row2 title)
>|---------|---------|---------|---------| (row1)
>|---------|---------|---------|---------| (row1)
>|------|------|------|                    (row2)
>|------|------|------|                    (row2)
>|---------|---------|---------|---------| (row1)
>|------|------|------|                    (row2)
>
>
>I want this type table  (ONE MORE added.)
>|---------|---------|---------|---------| (row1 title)
>|------|------|------|  (row2 title)
>|---------|---------|---------|---------| (row1)
>|---------|---------|---------|---------| (row1)
>|------|------|------|  (row2 title)
>|------|------|------|                    (row2)
>|------|------|------|                    (row2)
>|---------|---------|---------|---------| (row1)
>|------|------|------|  (row2 title)
>|------|------|------|                    (row2)
>
>or,
>
>|---------|---------|---------|---------| (row1 title)
>|------|------|------|  (row2 title)
>|---------|---------|---------|---------| (row1)
>|---------|---------|---------|---------| (row1)
>
>|------|------|------|  (row2 title)
>|------|------|------|                    (row2)
>|------|------|------|                    (row2)
>
>|---------|---------|---------|---------| (row1)
>
>|------|------|------|  (row2 title)
>|------|------|------|                    (row2)
>
>
>I tried but result is follow (I put the title in
>sub-table in "SUB/REPEAT" template)
>|---------|---------|---------|---------| (row1 title)
>|------|------|------|  (row2 title)
>|---------|---------|---------|---------| (row1)
>|---------|---------|---------|---------| (row1)
>|------|------|------|  (row2 title)
>|------|------|------|                    (row2)
>|------|------|------|  (row2 title)
>|------|------|------|                    (row2)
>|---------|---------|---------|---------| (row1)
>|------|------|------|  (row2 title)
>|------|------|------|                    (row2)
>Please lead me.
>Thank you for your good help
>  
>



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 267.3.3 - Release Date: 31/05/2005


Message Scanned by ClamAV on datalucid.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: table-row and sub table-rows problem:SUCCESS! and one more SUCCESS.

David Kim
Hi Mike,

I made two test-cases as you said and I got exact,
SUCCESSful outputs from both of them.
This is my first use 'preceding-sibling'.

I did like follow,
-------follow start-------------------------------
   <!-- ............................. -->
   <!--        'REPEAT'               -->
   <!-- ............................. -->
   <xsl:template match="SUB/REPEAT" >

        <fo:table-row>

        <fo:table-cell number-columns-spanned='3'>
        <fo:block>

                <!-- and now the table inside the cell -->
                <fo:table>
                <fo:table-column column-width="2cm" />
                <fo:table-column column-width="2cm" />
                <fo:table-column column-width="2cm" />

                <!--*** CASE 2-1 :START *** OK ***
  <xsl:if test='not(preceding-sibling::REPEAT[1])'>
                          <fo:table-header>
                            <fo:table-row height="0.4in" >
                              <fo:table-cell border-color="blue"
border-style="solid" border-width="thin">
                                <fo:block font-weight="bold" font-style=""
font-family="Times" font-size="10pt">
                                  SUB1
                                </fo:block>
                              </fo:table-cell>
                              <fo:table-cell border-color="red"
border-style="solid" border-width="thin">
                                <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="10pt">
                                  SUB2
                                </fo:block>
                              </fo:table-cell>
                              <fo:table-cell border-color="green"
border-style="solid" border-width="thin">
                                <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="10pt">
                                  SUB3
                                </fo:block>
                              </fo:table-cell>
                              </fo:table-row>
                            </fo:table-header>
  </xsl:if>
                *** CASE 2-1 :END ****************-->
 
  <fo:table-body>  <!-- ** %% Not header %% ** -->
 
                <!--*** CASE 2-2 :START *** OK ***-->
  <xsl:if test='not(preceding-sibling::REPEAT[1])'>
                            <fo:table-row height="0.4in" >
                              <fo:table-cell border-color="blue"
border-style="solid" border-width="thin">
                                <fo:block font-weight="bold" font-style=""
font-family="Times" font-size="10pt">
                                  SUB1
                                </fo:block>
                              </fo:table-cell>
                              <fo:table-cell border-color="red"
border-style="solid" border-width="thin">
                                <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="10pt">
                                  SUB2
                                </fo:block>
                              </fo:table-cell>
                              <fo:table-cell border-color="green"
border-style="solid" border-width="thin">
                                <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="10pt">
                                  SUB3
                                </fo:block>
                              </fo:table-cell>
                              </fo:table-row>
  </xsl:if>
                <!--*** CASE 2-2 :END ************-->
 
 
      <fo:table-row  height="0.2in">
     
        <fo:table-cell border-color="blue"
border-style="solid" border-width="thin" >
        <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
          <xsl:value-of select="SUB1" />
        </fo:block>
        </fo:table-cell>
       
        <fo:table-cell border-color="grey"
border-style="solid" border-width="thin"  >
        <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
          <xsl:value-of select="SUB2" />
        </fo:block>
        </fo:table-cell>
       
        <fo:table-cell border-color="green"
border-style="solid" border-width="thin" >
        <fo:block font-weight="bold"
font-style="italic" font-family="Times"
font-size="13pt">
          <xsl:value-of select="SUB3" />
        </fo:block>
        </fo:table-cell>
       
       
      </fo:table-row>
     
  </fo:table-body>
                </fo:table>

                <!-- end of included table -->

        </fo:block>
        </fo:table-cell>
        </fo:table-row>

 
   </xsl:template>
-------follow end-------------------------------

Sub table problem was not easy to me.
You helped me a lot.
Thank you for leading me and your great help.
David.
--- Mike Trotman <[hidden email]> wrote:

> Hi David.
>
> Various ways of doing this.
>
> Simplest change to your existing code is probably to
> insert an <xsl:if>
> block in your current SUB/REPEAT template match
> around the code for the title row.
>
> To get the title on just the 1st 'ROW2' you would
> need to test that
> there are no other REPEATs immediately before (i.e.
> this is the 1st)
> so the IF would be something like
>
> <xsl:if test='not(preceding-sibling::REPEAT[1])'>
> <fo:table-row ...>
> ... and then the <fo:table-cell>s for your titles
> </fo:table-row>
> </xsl:if>
>
> Also see below for where to insert this.
>
>
> Mike
>
> David Kim wrote:
>
> >Mike, You are right! I got a good result that I
> wanted
> >exactly.
> >I put a table in '<xsl:template match="SUB/REPEAT"
> >'
> >as you said, and I got it.
> >I tested it several times and I was able to get
> simple
> >change.
> ><xsl:template match="SUB/REPEAT" > is only one
> thing
> >changed as follow,
> >
> >-------follow start-------------------------------
> >   <!-- ............................. -->
> >   <!--        'REPEAT'               -->
> >   <!-- ............................. -->
> >   <xsl:template match="SUB/REPEAT" >
> >
> > <fo:table-row>
> >
> > <fo:table-cell number-columns-spanned='3'>
> > <fo:block>
> >
> > <!-- and now the table inside the cell -->
> > <fo:table>
> > <fo:table-column column-width="2cm" />
> > <fo:table-column column-width="2cm" />
> > <fo:table-column column-width="2cm" />
> >
> > <fo:table-body> <!-- ** %% Not header %% ** -->
> >  
> >
> INSERT THE <XSL:IF> HERE
>
> >     <fo:table-row  height="0.2in">
> >    
> >       <fo:table-cell border-color="blue"
> >border-style="solid" border-width="thin" >
> >         <fo:block font-weight="bold"
> >font-style="italic" font-family="Times"
> >font-size="13pt">
> >           <xsl:value-of select="SUB1" />
> >         </fo:block>
> >       </fo:table-cell>
> >      
> >       <fo:table-cell border-color="grey"
> >border-style="solid" border-width="thin"  >
> >         <fo:block font-weight="bold"
> >font-style="italic" font-family="Times"
> >font-size="13pt">
> >           <xsl:value-of select="SUB2" />
> >         </fo:block>
> >       </fo:table-cell>
> >      
> >       <fo:table-cell border-color="green"
> >border-style="solid" border-width="thin" >
> >         <fo:block font-weight="bold"
> >font-style="italic" font-family="Times"
> >font-size="13pt">
> >           <xsl:value-of select="SUB3" />
> >         </fo:block>
> >       </fo:table-cell>
> >      
> >      
> >     </fo:table-row>
> > </fo:table-body>
> > </fo:table>
> >
> > <!-- end of included table -->
> >
> > </fo:block>
> > </fo:table-cell>
> > </fo:table-row>
> >
> >
> >   </xsl:template>
> >-------follow end-------------------------------
> >
> >I did one more try. I tried to get sub title as
> follow
> >I think this try is your first suggestion(Using
> >seperate tables).
> >
> >CASE 2
> >
> >
> >Current result is follow (SUCCESS! first test case)
> >|---------|---------|---------|---------| (row1
> title)
> >|------|------|------|  (row2 title)
> >|---------|---------|---------|---------| (row1)
> >|---------|---------|---------|---------| (row1)
> >|------|------|------|                    (row2)
> >|------|------|------|                    (row2)
> >|---------|---------|---------|---------| (row1)
> >|------|------|------|                    (row2)
> >
> >
> >I want this type table  (ONE MORE added.)
> >|---------|---------|---------|---------| (row1
> title)
> >|------|------|------|  (row2 title)
> >|---------|---------|---------|---------| (row1)
> >|---------|---------|---------|---------| (row1)
> >|------|------|------|  (row2 title)
> >|------|------|------|                    (row2)
> >|------|------|------|                    (row2)
> >|---------|---------|---------|---------| (row1)
> >|------|------|------|  (row2 title)
> >|------|------|------|                    (row2)
> >
> >or,
> >
> >|---------|---------|---------|---------| (row1
> title)
> >|------|------|------|  (row2 title)
> >|---------|---------|---------|---------| (row1)
> >|---------|---------|---------|---------| (row1)
> >
> >|------|------|------|  (row2 title)
> >|------|------|------|                    (row2)
> >|------|------|------|                    (row2)
> >
> >|---------|---------|---------|---------| (row1)
> >
> >|------|------|------|  (row2 title)
> >|------|------|------|                    (row2)
> >
> >
> >I tried but result is follow (I put the title in
> >sub-table in "SUB/REPEAT" template)
> >|---------|---------|---------|---------| (row1
> title)
> >|------|------|------|  (row2 title)
> >|---------|---------|---------|---------| (row1)
> >|---------|---------|---------|---------| (row1)
> >|------|------|------|  (row2 title)
> >|------|------|------|                    (row2)
> >|------|------|------|  (row2 title)
> >|------|------|------|                    (row2)
> >|---------|---------|---------|---------| (row1)
> >|------|------|------|  (row2 title)
> >|------|------|------|                    (row2)
> >Please lead me.
> >Thank you for your good help
> >  
> >
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.322 / Virus Database: 267.3.3 - Release
> Date: 31/05/2005
>
>
> Message Scanned by ClamAV on datalucid.com
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [hidden email]
> For additional commands, e-mail:
> [hidden email]
>
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]