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 Jacob Bager <jb...@an-concepts.dk> on 2003/01/24 21:28:22 UTC

Howto make tables...

Hi ...

I know this is a very stupid question, but after browsing the net for a
tutorial,
Working for me, with NO luck at all. I have to ask here.

This it what i wanna do..

 (Im using the xsl:fo on a tomcat/cocoon installation., Just for a
notice.)

I have created an XML.file located at
http://approveone.phaseone.com/pdf/20030124210359.xml ,
To make it easy for me too, print to a pdf. I created it like so
 -document
   -page
    -table
     -row
      -cell
      -cell
      -cell
     -/row
Etc..... A table with 3x3, with page breaks foreach page.

Every cell contains a href to an image, and text for that picture.

Every time i try, putting it through for .pdf i get 'The file is
damaged'.

Can anyone help me?

Im quiet desperat.

Thanx in advanced.
Jacob Bager
Denmark.



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: Howto make tables...

Posted by Jacob Bager <jb...@an-concepts.dk>.
Thanx a bunch.....

It's late i'll have a look at it tomorrow.


-----Original Message-----
From: Clay Leeds [mailto:cleeds@medata.com] 
Sent: 24. januar 2003 22:29
To: fop-user@xml.apache.org
Subject: Re: Howto make tables...


Jacob,

Jacob Bager wrote:
> Hi ...
> 
> I know this is a very stupid question, but after browsing the net for 
> a tutorial, Working for me, with NO luck at all. I have to ask here.
> 
> This it what i wanna do..
> 
> (Im using the xsl:fo on a tomcat/cocoon installation., Just for a 
> notice.)
> 
> I have created an XML.file located at 
> http://approveone.phaseone.com/pdf/20030124210359.xml , To make it 
> easy for me too, print to a pdf. I created it like so  -document
>    -page
>     -table
>      -row
>       -cell
>       -cell
>       -cell
>      -/row
> Etc..... A table with 3x3, with page breaks foreach page.

You'll have to figure out the rest, but here's more of a start than I 
got. Hope this helps!

Web Maestro Clay

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:fo="http://www.w3.org/1999/XSL/Format">
   <xsl:template match="/">
     <xsl:apply-templates select="doc"/>
   </xsl:template>
   <xsl:template match="doc">
     <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
       <!--  defines page layout -->
       <fo:layout-master-set>
         <fo:simple-page-master master-name="repeating" 
page-height="28cm" page-width="22cm" margin-top="1cm" 
margin-bottom="1.3cm" margin-left="1cm" margin-right="1cm">
           <fo:region-body margin-bottom="6.5cm" margin-top="7.6cm"/>
           <fo:region-before extent="7.6cm"/>
           <fo:region-after extent="6.5cm"/>
         </fo:simple-page-master>
         <fo:page-sequence-master master-name="repeating_pm">
           <fo:repeatable-page-master-reference
master-name="repeating"/>
         </fo:page-sequence-master>
       </fo:layout-master-set>
       <!-- DEFINE PAGE SEQUENCE - repeating -->
       <fo:page-sequence master-reference="repeating">
         <fo:static-content flow-name="xsl-region-before">
           <fo:block padding="0pt" xsl:use-attribute-sets="attNormal">
             <xsl:call-template name="tmpHeader"/>
           </fo:block>
         </fo:static-content>
         <fo:static-content flow-name="xsl-region-after">
           <fo:block xsl:use-attribute-sets="attNormal">
             <xsl:call-template name="tmpFooter"/>
           </fo:block>
         </fo:static-content>
         <fo:flow flow-name="xsl-region-body">
           <fo:block>
             <xsl:call-template name="tmpBody"/>
           </fo:block>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
   </xsl:template>
   <!-- REGION-BEFORE: tmpHeader TEMPLATE -->
   <xsl:template name="tmpHeader">
     <fo:block padding="0pt">
       <!-- REGION-BEFORE (Header) CONTENT -->
     </fo:block>
   </xsl:template>
   <!-- REGION-AFTER: tmpFooter TEMPLATE -->
   <xsl:template name="tmpFooter">
     <fo:block padding="0pt">
       <!-- REGION-AFTER (Footer) CONTENT -->
     </fo:block>
   </xsl:template>
   <!-- REGION-BODY: tmpBody TEMPLATE -->
   <xsl:template name="tmpBody">
     <fo:block padding="0pt">
       <!-- REGION-BODY (Body) CONTENT -->
         <xsl:call-template name="tmpTable"/>
     </fo:block>
   </xsl:template>
   <xsl:template name="tmpTable">
     <fo:block padding="0pt">
       <fo:table border="0pt" table-layout="fixed" margin-top="4pt">
         <fo:table-column column-width="5cm"/>
         <fo:table-column column-width="5cm"/>
         <fo:table-column column-width="5cm"/>
         <fo:table-body>
           <fo:table-row>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 1
               </fo:block>
             </fo:table-cell>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 2
               </fo:block>
             </fo:table-cell>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 3
               </fo:block>
             </fo:table-cell>
           </fo:table-row>
           <fo:table-row>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 1
               </fo:block>
             </fo:table-cell>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 2
               </fo:block>
             </fo:table-cell>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 3
               </fo:block>
             </fo:table-cell>
           </fo:table-row>
           <fo:table-row>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 1
               </fo:block>
             </fo:table-cell>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 2
               </fo:block>
             </fo:table-cell>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 3
               </fo:block>
             </fo:table-cell>
           </fo:table-row>
         </fo:table-body>
       </fo:table>
     </fo:block>
   </xsl:template>
</xsl:stylesheet>

-- 
Clay Leeds - cleeds@medata.com
Web Developer - Medata, Inc. - http://www.medata.com
PGP Public Key: https://mail.medata.com/pgp/cleeds.asc


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: Howto make tables...

Posted by Clay Leeds <cl...@medata.com>.
Jacob,

Jacob Bager wrote:
> Hi ...
> 
> I know this is a very stupid question, but after browsing the net for a
> tutorial, Working for me, with NO luck at all. I have to ask here.
> 
> This it what i wanna do..
> 
> (Im using the xsl:fo on a tomcat/cocoon installation., Just for a notice.)
> 
> I have created an XML.file located at
> http://approveone.phaseone.com/pdf/20030124210359.xml ,
> To make it easy for me too, print to a pdf. I created it like so
>  -document
>    -page
>     -table
>      -row
>       -cell
>       -cell
>       -cell
>      -/row
> Etc..... A table with 3x3, with page breaks foreach page.

You'll have to figure out the rest, but here's more of a start than I 
got. Hope this helps!

Web Maestro Clay

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:fo="http://www.w3.org/1999/XSL/Format">
   <xsl:template match="/">
     <xsl:apply-templates select="doc"/>
   </xsl:template>
   <xsl:template match="doc">
     <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
       <!--  defines page layout -->
       <fo:layout-master-set>
         <fo:simple-page-master master-name="repeating" 
page-height="28cm" page-width="22cm" margin-top="1cm" 
margin-bottom="1.3cm" margin-left="1cm" margin-right="1cm">
           <fo:region-body margin-bottom="6.5cm" margin-top="7.6cm"/>
           <fo:region-before extent="7.6cm"/>
           <fo:region-after extent="6.5cm"/>
         </fo:simple-page-master>
         <fo:page-sequence-master master-name="repeating_pm">
           <fo:repeatable-page-master-reference master-name="repeating"/>
         </fo:page-sequence-master>
       </fo:layout-master-set>
       <!-- DEFINE PAGE SEQUENCE - repeating -->
       <fo:page-sequence master-reference="repeating">
         <fo:static-content flow-name="xsl-region-before">
           <fo:block padding="0pt" xsl:use-attribute-sets="attNormal">
             <xsl:call-template name="tmpHeader"/>
           </fo:block>
         </fo:static-content>
         <fo:static-content flow-name="xsl-region-after">
           <fo:block xsl:use-attribute-sets="attNormal">
             <xsl:call-template name="tmpFooter"/>
           </fo:block>
         </fo:static-content>
         <fo:flow flow-name="xsl-region-body">
           <fo:block>
             <xsl:call-template name="tmpBody"/>
           </fo:block>
         </fo:flow>
       </fo:page-sequence>
     </fo:root>
   </xsl:template>
   <!-- REGION-BEFORE: tmpHeader TEMPLATE -->
   <xsl:template name="tmpHeader">
     <fo:block padding="0pt">
       <!-- REGION-BEFORE (Header) CONTENT -->
     </fo:block>
   </xsl:template>
   <!-- REGION-AFTER: tmpFooter TEMPLATE -->
   <xsl:template name="tmpFooter">
     <fo:block padding="0pt">
       <!-- REGION-AFTER (Footer) CONTENT -->
     </fo:block>
   </xsl:template>
   <!-- REGION-BODY: tmpBody TEMPLATE -->
   <xsl:template name="tmpBody">
     <fo:block padding="0pt">
       <!-- REGION-BODY (Body) CONTENT -->
         <xsl:call-template name="tmpTable"/>
     </fo:block>
   </xsl:template>
   <xsl:template name="tmpTable">
     <fo:block padding="0pt">
       <fo:table border="0pt" table-layout="fixed" margin-top="4pt">
         <fo:table-column column-width="5cm"/>
         <fo:table-column column-width="5cm"/>
         <fo:table-column column-width="5cm"/>
         <fo:table-body>
           <fo:table-row>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 1
               </fo:block>
             </fo:table-cell>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 2
               </fo:block>
             </fo:table-cell>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 3
               </fo:block>
             </fo:table-cell>
           </fo:table-row>
           <fo:table-row>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 1
               </fo:block>
             </fo:table-cell>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 2
               </fo:block>
             </fo:table-cell>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 3
               </fo:block>
             </fo:table-cell>
           </fo:table-row>
           <fo:table-row>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 1
               </fo:block>
             </fo:table-cell>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 2
               </fo:block>
             </fo:table-cell>
             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
                 Cell 3
               </fo:block>
             </fo:table-cell>
           </fo:table-row>
         </fo:table-body>
       </fo:table>
     </fo:block>
   </xsl:template>
</xsl:stylesheet>

-- 
Clay Leeds - cleeds@medata.com
Web Developer - Medata, Inc. - http://www.medata.com
PGP Public Key: https://mail.medata.com/pgp/cleeds.asc


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: Howto make tables...

Posted by Thorsten Scherler <th...@wyona.org>.

Jacob Bager wrote:
> Err...
> 
> I thougt the <template match="IMAGEINFO"> was the template?
> 
> The IMAGEINFO is tag in the .XML, like <IMAGEINFO>foo.bar</IMAGEINFO>
> I want to write foo.bar i the <fo:table-cell> 

that would be <xsl:value-of select="XPATH_to/IMAGEINFO"/>

<fo:table-cell padding="1pt">
 >>               <fo:block keep-with-next.within-page="always">
 >>		     <xsl:value-of select="XPATH_to/IMAGEINFO"/>
 >>		        <fo:block font-size="10px" font-style="italic"
 >>text-align="center">
 >>            	   <xsl:apply-templates/>
 >>        		  </fo:block>
 >>    		     </xsl:template>
 >>               </fo:block>
 >>             </fo:table-cell>

> 
> Jacob
> 
> 
> 
> -----Original Message-----
> From: Clay Leeds [mailto:cleeds@medata.com] 
> Sent: 25. januar 2003 00:39
> To: fop-user@xml.apache.org
> Subject: Re: Howto make tables...
> 
> 
> Jacob Bager wrote:
> 
>>Your right J.
>>
>>It was missing the table-body element.
>>
>>I have experimented with the xsl. Clay Leeds provided, its Working. 
>>But i havn't managed to get any data in from the xml-file. I tried 
>>this :
>>
>>             <fo:table-cell padding="1pt">
>>               <fo:block keep-with-next.within-page="always">
>>		     <xsl:template match="IMAGEINFO">
>>		        <fo:block font-size="10px" font-style="italic" 
>>text-align="center">
>>            	   <xsl:apply-templates/>
>>        		  </fo:block>
>>    		     </xsl:template>               
>>               </fo:block>
>>             </fo:table-cell>
>>
>>Have i totaly misunderstood something here, or shouldn't it work?
>>
>>Jacob Bager
>>Denmark
> 
> 
> It would help to see your template "IMAGEINFO" to get an idea of what's 
> going wrong here.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: Howto make tables...

Posted by Jacob Bager <jb...@an-concepts.dk>.
Err...

I thougt the <template match="IMAGEINFO"> was the template?

The IMAGEINFO is tag in the .XML, like <IMAGEINFO>foo.bar</IMAGEINFO>
I want to write foo.bar i the <fo:table-cell> 

Jacob



-----Original Message-----
From: Clay Leeds [mailto:cleeds@medata.com] 
Sent: 25. januar 2003 00:39
To: fop-user@xml.apache.org
Subject: Re: Howto make tables...


Jacob Bager wrote:
> Your right J.
> 
> It was missing the table-body element.
> 
> I have experimented with the xsl. Clay Leeds provided, its Working. 
> But i havn't managed to get any data in from the xml-file. I tried 
> this :
> 
>              <fo:table-cell padding="1pt">
>                <fo:block keep-with-next.within-page="always">
> 		     <xsl:template match="IMAGEINFO">
> 		        <fo:block font-size="10px" font-style="italic" 
> text-align="center">
>             	   <xsl:apply-templates/>
>         		  </fo:block>
>     		     </xsl:template>               
>                </fo:block>
>              </fo:table-cell>
> 
> Have i totaly misunderstood something here, or shouldn't it work?
> 
> Jacob Bager
> Denmark

It would help to see your template "IMAGEINFO" to get an idea of what's 
going wrong here.

-- 
Clay Leeds - cleeds@medata.com
Web Developer - Medata, Inc. - http://www.medata.com
PGP Public Key: https://mail.medata.com/pgp/cleeds.asc


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: Howto make tables...

Posted by Clay Leeds <cl...@medata.com>.
Jacob Bager wrote:
> Your right J.
> 
> It was missing the table-body element.
> 
> I have experimented with the xsl. Clay Leeds provided, its
> Working. But i havn't managed to get any data in from the xml-file.
> I tried this :
> 
>              <fo:table-cell padding="1pt">
>                <fo:block keep-with-next.within-page="always">
> 		     <xsl:template match="IMAGEINFO">
> 		        <fo:block font-size="10px" font-style="italic"
> text-align="center">
>             	   <xsl:apply-templates/>
>         		  </fo:block>
>     		     </xsl:template>               
>                </fo:block>
>              </fo:table-cell>
> 
> Have i totaly misunderstood something here, or shouldn't it work?
> 
> Jacob Bager
> Denmark

It would help to see your template "IMAGEINFO" to get an idea of what's 
going wrong here.

-- 
Clay Leeds - cleeds@medata.com
Web Developer - Medata, Inc. - http://www.medata.com
PGP Public Key: https://mail.medata.com/pgp/cleeds.asc


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: Howto make tables...

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Jacob Bager wrote:
> I've found the page
> http://www.w3.org/TR/xsl/slice6.html#section-N15442-Formatting-Objects-f
> or-Tables
> And tried the first example.... 
> 
> But i get a 'file is damaged'-error from acrobat. 

The fo:table-and-caption element is not implemented by FOP,
you should see an error message (look into your Cocoon
log files).
Again: Don't use Cocoon for inintial development.

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: Howto make tables...

Posted by Jacob Bager <jb...@an-concepts.dk>.
So its ..

<xsl:template....
  <fo:table-cell...
  <xsl:apply...
  </fo:table-cell>
</xsl:template>


I've found the page
http://www.w3.org/TR/xsl/slice6.html#section-N15442-Formatting-Objects-f
or-Tables
And tried the first example.... 

But i get a 'file is damaged'-error from acrobat. 

I think there something wrong with my installation.

Jacob Bager

-----Original Message-----
From: J.Pietschmann [mailto:j3322ptm@yahoo.de] 
Sent: 25. januar 2003 01:25
To: fop-user@xml.apache.org
Subject: Re: Howto make tables...


Jacob Bager wrote:
>              <fo:table-cell padding="1pt">
>                <fo:block keep-with-next.within-page="always">
> 		     <xsl:template match="IMAGEINFO">

This is an error. A xsl:template must be an immediate
child of the xsl:stylesheet element.

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: Howto make tables...

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Jacob Bager wrote:
>              <fo:table-cell padding="1pt">
>                <fo:block keep-with-next.within-page="always">
> 		     <xsl:template match="IMAGEINFO">

This is an error. A xsl:template must be an immediate
child of the xsl:stylesheet element.

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: Howto make tables...

Posted by Jacob Bager <jb...@an-concepts.dk>.
Your right J.

It was missing the table-body element.

I have experimented with the xsl. Clay Leeds provided, its
Working. But i havn't managed to get any data in from the xml-file.
I tried this :

             <fo:table-cell padding="1pt">
               <fo:block keep-with-next.within-page="always">
		     <xsl:template match="IMAGEINFO">
		        <fo:block font-size="10px" font-style="italic"
text-align="center">
            	   <xsl:apply-templates/>
        		  </fo:block>
    		     </xsl:template>               
               </fo:block>
             </fo:table-cell>

Have i totaly misunderstood something here, or shouldn't it work?

Jacob Bager
Denmark

-----Original Message-----
From: J.Pietschmann [mailto:j3322ptm@yahoo.de] 
Sent: 25. januar 2003 00:07
To: fop-user@xml.apache.org
Subject: Re: Howto make tables...


Jacob Bager wrote:
>  (Im using the xsl:fo on a tomcat/cocoon installation., Just for a
> notice.)
...
> Every time i try, putting it through for .pdf i get 'The file is 
> damaged'.

Most likely there is a problem with the FO. One cause
often seen with tables is a missing table body element.
Look into the cocoon logs for exceptions and error
messages.
You should develop everything with the FOP command line application,
perhaps using the -d flag, in order to get error messages more
conveniently.

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: Howto make tables...

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Jacob Bager wrote:
>  (Im using the xsl:fo on a tomcat/cocoon installation., Just for a
> notice.)
...
> Every time i try, putting it through for .pdf i get 'The file is
> damaged'.

Most likely there is a problem with the FO. One cause
often seen with tables is a missing table body element.
Look into the cocoon logs for exceptions and error
messages.
You should develop everything with the FOP command line
application, perhaps using the -d flag, in order to get
error messages more conveniently.

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org