You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Tim Bachta <tb...@kopent.com> on 2003/05/14 16:53:31 UTC

Cocoon xml:fo question

Hi all,  I don't know if this is the right place for this question,
hopefully someone here can help me, but I am having some trouble
displaying a table of data in a PDF file.  I have no problem displaying
this data in html using cocoon but my transition to the PDF format has
been a little rough to say the least.  Here is the code that I am using.


 

Xsp

 

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp-session="http://apache.org/xsp/session/2.0">

       <xsp:structure>

             <xsp:include>java.util.Date</xsp:include>

       </xsp:structure>

       <xsp:logic>

             Date now = new Date();

       </xsp:logic>

       <page>

             <title>Overdue Tasks as of <xsp:expr>now</xsp:expr>

             </title>

             <content>

                    <esql:connection>

                           <esql:pool>vyzo</esql:pool>

                           <esql:execute-query>

                                 <esql:query>

                                 execute rptOverdueTasks

                           </esql:query>

                                 <esql:results>

                                        <tasks>

                                               <esql:row-results>

                                                     <task>

 
<esql:get-columns/>

                                                     </task>

                                               </esql:row-results>

                                        </tasks>

                                 </esql:results>

                           </esql:execute-query>

                    </esql:connection>

             </content>

       </page>

</xsp:page>

 

 

XSL

 

<?xml version="1.0"?>

<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="page">

       <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

             <fo:layout-master-set>

                    <fo:simple-page-master master-name="page"
page-height="11in" page-width="8.5in">

                           <fo:region-body region-name="xsl-region-body"
margin="0.7in" />

                           <fo:region-before
region-name="xsl-region-before" extent="0.7in" />

                           <fo:region-after
region-name="xsl-region-after" extent="0.7in" />

                    </fo:simple-page-master>

                    

                    

             </fo:layout-master-set>

             

             <fo:page-sequence master-reference="page">

                    <fo:static-content flow-name="xsl-region-after">

                           <fo:block text-align="center"
font-size="10pt" font-family="Courier" line-height="14pt">

                           Page

                           <fo:page-number/>

                           </fo:block>

                    </fo:static-content>

                    <fo:flow flow-name="xsl-region-body" >

                           <xsl:apply-templates/>

                    </fo:flow>

             </fo:page-sequence>

       </fo:root>

</xsl:template>

 

<xsl:template match="title">

       <fo:block font-size="16pt" font-family="Helvetica"
space-before.optimum="24pt" text-aling="center">

             <xsl:apply-templates/>

       </fo:block>

</xsl:template>

 

<xsl:template match="paragraph">

       <fo:block font-size="12pt" font-family="Times"
space-before.optimum="12pt" text-aling="center">

             <xsl:apply-templates/>

       </fo:block>

</xsl:template>

 

 

<xsl:template match="tasks">

       <fo:table border="solid 1px black">

             <fo:table-body>

                    <xsl:apply-templates/>

             </fo:table-body>

       </fo:table>

</xsl:template>

 

<xsl:template match="task">

       <xsl:for-each select="*">

             <fo:table-row>

                    <fo:table-cell border="solid 1px red">

                           <fo:block><xsl:apply-templates/></fo:block>

                    </fo:table-cell>

             </fo:table-row>

       </xsl:for-each>

</xsl:template>

 

</xsl:stylesheet>

 

 

I am getting the title and the page number on the PDF and nothing else.
If anyone can help or please point me in the right direction it would be
greatly appreciated.  I am new to this environment and have found it
very useful and cool so far, so please excuse my ignorance if I made a
stupid mistake.

 

Thanks in Advance, 

 

Tim Bachta

 

 

 


Re: Cocoon xml:fo question

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Tim Bachta wrote:
> Hi all,  I don't know if this is the right place for this question,

A better place would be to isolate the problem and ask on the
fop-user or on the XSL list.

> hopefully someone here can help me, but I am having some trouble
> displaying a table of data in a PDF file.  I have no problem displaying
> this data in html using cocoon but my transition to the PDF format has
> been a little rough to say the least.  Here is the code that I am using.

The code is not of much help in order to reproduce the problem.
1. Look into the Cocoon logs for possible problems logged by the
    PDF serializer.
2. Replace the PDF serializer with an XML serializer and save the
    file to disk. Check whether the content looks good. Get a FOP
    distribution and use the command line app to produce a PDF.
    Watch out for possible problem reports. Repeat with the -d
    flag, if necessary.

Maybe the problem is here:
>        <fo:table border="solid 1px black">
>              <fo:table-body>

FOP needs declarations for the table columns.


J.Pietschmann


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