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 Kaustuva Narayan Sharma <ka...@sysarris.soft.net> on 2004/05/27 15:47:58 UTC

Table Header problem

 
 
Hi,
 
I am a beginner to FOP. I am trying to convert an XML to PDF from a Java
app. The data is to be displayed in a table. But when I try to put
headers into the table i am getting the following error:
 
org.apache.fop.apps.FOPException: Currently only Table Rows are
supported in table body, header and footer

My xsl looks like this:
 
======================================================================
 
 <fo:table>
 
   <fo:table-header>
   <fo:table-row>
     <fo:table-cell>
 <fo:block font-size="12pt" font-weight="bold">Header1</fo:block>
     </fo:table-cell>
     <fo:table-cell>
 <fo:block font-size="12pt" font-weight="bold">Header2</fo:block>
     </fo:table-cell>
     <fo:table-cell>
 <fo:block font-size="12pt" font-weight="bold">Header3</fo:block>
     </fo:table-cell>
    </fo:table-row>
   </fo:table-header>
      <fo:table-body>
 
    <fo:table-row>
      <fo:table-cell>
        <fo:block>
          <xsl:value-of select="Data1"/>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell>
        <fo:block>
          <xsl:value-of select="Data2"/>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell>
        <fo:block>
          <xsl:value-of select="Data3"/>
        </fo:block>
      </fo:table-cell>
    </fo:table-row>
    </fo:table-body>
     </fo:table>
=====================================================
 
 
I am using fop-0.20.5. Can you pls suggest as to what could be the
cause?
 
Thanks.

Regards,

Kaustuv Sharma


 


RE: Table Header problem

Posted by Kaustuva Narayan Sharma <ka...@sysarris.soft.net>.
I got it thanks....a sily mistake on may part :-)
This is my whole xsl file. And tables with headers r generating fine :

=============================================================

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
exclude-result-prefixes="fo">
  <xsl:output method="xml" version="1.0" omit-xml-declaration="no"
indent="yes"/>
   <xsl:template match="Report">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
        <fo:simple-page-master master-name="simpleA4"
page-height="29.7cm" page-width="21cm" margin-top="2cm"
margin-bottom="2cm" margin-left="2cm" margin-right="2cm">
          <fo:region-body/>
        </fo:simple-page-master>
      </fo:layout-master-set>
      <fo:page-sequence master-reference="simpleA4">
        <fo:flow flow-name="xsl-region-body">
           <fo:block font-size="10pt">
            <fo:table table-layout="fixed">
              <fo:table-column column-width="4cm"/>
              <fo:table-column column-width="4cm"/>
              <fo:table-column column-width="5cm"/>
	      <fo:table-header>
	         <fo:table-row>
		 <fo:table-cell>
		 <fo:block font-size="12pt"
font-weight="bold">Header1</fo:block>
		 </fo:table-cell>
		 <fo:table-cell>
		 <fo:block font-size="12pt"
font-weight="bold">Header2</fo:block>
		 </fo:table-cell>
		 <fo:table-cell>
		 <fo:block font-size="12pt"
font-weight="bold">Header3</fo:block>
		 </fo:table-cell>
		 </fo:table-row>
	     </fo:table-header>
              <fo:table-body>
                <xsl:apply-templates/>
              </fo:table-body>
            </fo:table>
          </fo:block>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </xsl:template>
  <xsl:template match="R">
    <fo:table-row>
      <fo:table-cell>
        <fo:block>
          <xsl:value-of select="Data1"/>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell>
        <fo:block>
          <xsl:value-of select="Data2"/>
        </fo:block>
      </fo:table-cell>
      <fo:table-cell>
        <fo:block>
          <xsl:value-of select="Data3"/>
        </fo:block>
      </fo:table-cell>
    </fo:table-row>
  </xsl:template>
</xsl:stylesheet>

=======================================================

-----Original Message-----
From: Clay Leeds [mailto:cleeds@medata.com] 
Sent: Thursday, May 27, 2004 7:50 PM
To: fop-user@xml.apache.org
Subject: Re: Table Header problem


On May 27, 2004, at 6:47 AM, Kaustuva Narayan Sharma wrote:
> Hi,
>
> I am a beginner to FOP. I am trying to convert an XML to PDF from a
> Java app. The data is to be displayed in a table. But when I try to 
> put headers into the table i am getting the following error:
>
> org.apache.fop.apps.FOPException: Currently only Table Rows are
> supported in table body, header and footer
>
> My xsl looks like this: 
> ======================================================================
>  <fo:table>
>  
>    <fo:table-header>
>    <fo:table-row>
>      <fo:table-cell>
>  <fo:block font-size="12pt" font-weight="bold">Header1</fo:block>
>      </fo:table-cell>
>      <fo:table-cell>
>  <fo:block font-size="12pt" font-weight="bold">Header2</fo:block>
>      </fo:table-cell>
>      <fo:table-cell>
>  <fo:block font-size="12pt" font-weight="bold">Header3</fo:block>
>      </fo:table-cell>
>     </fo:table-row>
>    </fo:table-header>
>       <fo:table-body>
>
>     <fo:table-row>
>       <fo:table-cell>
>         <fo:block>
>           <xsl:value-of select="Data1"/>
>         </fo:block>
>       </fo:table-cell>
>       <fo:table-cell>
>         <fo:block>
>           <xsl:value-of select="Data2"/>
>         </fo:block>
>       </fo:table-cell>
>       <fo:table-cell>
>         <fo:block>
>           <xsl:value-of select="Data3"/>
>         </fo:block>
>       </fo:table-cell>
>     </fo:table-row>
>     </fo:table-body>
>      </fo:table> =====================================================
>
> I am using fop-0.20.5. Can you pls suggest as to what could be the
> cause?
>
> Thanks.
>
> Regards,
>
> Kaustuv Sharma

One problem I notice is that you do not have <fo:table-column 
column-width="XXcm" />. You can see an example of a complete table 
here:

http://xml.apache.org/fop/faq.html#keep-with

I don't know if it's a problem but there was a lot of extra white space 
in the table-body. Whitespace is OK, but perhaps there's a bad 
character in there?

Hope this helps!

Web Maestro Clay

---------------------------------------------------------------------
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: Table Header problem

Posted by Clay Leeds <cl...@medata.com>.
On May 27, 2004, at 6:47 AM, Kaustuva Narayan Sharma wrote:
> Hi,
>
> I am a beginner to FOP. I am trying to convert an XML to PDF from a 
> Java app. The data is to be displayed in a table. But when I try to 
> put headers into the table i am getting the following error:
>
> org.apache.fop.apps.FOPException: Currently only Table Rows are 
> supported in table body, header and footer
>
> My xsl looks like this:
> ======================================================================
>  <fo:table>
>  
>    <fo:table-header>
>    <fo:table-row>
>      <fo:table-cell>
>  <fo:block font-size="12pt" font-weight="bold">Header1</fo:block>
>      </fo:table-cell>
>      <fo:table-cell>
>  <fo:block font-size="12pt" font-weight="bold">Header2</fo:block>
>      </fo:table-cell>
>      <fo:table-cell>
>  <fo:block font-size="12pt" font-weight="bold">Header3</fo:block>
>      </fo:table-cell>
>     </fo:table-row>
>    </fo:table-header>
>       <fo:table-body>
>
>     <fo:table-row>
>       <fo:table-cell>
>         <fo:block>
>           <xsl:value-of select="Data1"/>
>         </fo:block>
>       </fo:table-cell>
>       <fo:table-cell>
>         <fo:block>
>           <xsl:value-of select="Data2"/>
>         </fo:block>
>       </fo:table-cell>
>       <fo:table-cell>
>         <fo:block>
>           <xsl:value-of select="Data3"/>
>         </fo:block>
>       </fo:table-cell>
>     </fo:table-row>
>     </fo:table-body>
>      </fo:table>
> =====================================================
>
> I am using fop-0.20.5. Can you pls suggest as to what could be the 
> cause?
>
> Thanks.
>
> Regards,
>
> Kaustuv Sharma

One problem I notice is that you do not have <fo:table-column 
column-width="XXcm" />. You can see an example of a complete table 
here:

http://xml.apache.org/fop/faq.html#keep-with

I don't know if it's a problem but there was a lot of extra white space 
in the table-body. Whitespace is OK, but perhaps there's a bad 
character in there?

Hope this helps!

Web Maestro Clay

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