You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Scott Jones <sc...@izio.com> on 2000/11/01 06:34:34 UTC

FOP + Cocoon -- Inconsistent Response?

Hi,

I'm generating a dynamic PDF file using a namespace taglib, and a XSL
transform using FOP (I've got snippets of each file included below).
However, I am struggling because I cannot seem to get my PDF get generated
consistently...  Oftentimes, a request from the browser will time-out, but
at other times, it works perfectly.  The page is dependant upon request
variables, and when I send illegal values through the URL, it *always*
causes a Cocoon error.  So, the problem occurs somewhere after the XSP
processing, it seems...

I have tried each of the Cocoon FAQ suggestions for getting IE to work
correctly with FOP generated PDFs, but this problem is plaguing every
browser that I have (and creating a servlet and/or changing the file
extension to ".pdf" has not helped with the consistency).  This is running
on a Redhat Linux 7 box with a PIII 600 CPU and 256 MB of RAM -- I've
noticed that I'm using all of my memory (with just a few megs in swap).
Could that be the problem?

Thanks for any suggestions that anyone might have...

I am using Cocoon 1.8, Tomcat 3.2 b6, FOP 0.13 (I didn't end up upgrading to
Tomcat 4, Cocoon 2 and the latest FOP CVS, just because I was nervous about
using so many bleeding edge components -- I need to go live with this stuff
in January!).  Thanks you!

-Scott


test.xml   (This file is about 13k or so total).
==========================================
<?xml version="1.0"?>

<?cocoon-process type="xsp"?>
<?xml-logicsheet href="test.xsp.xsl"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="test.fo.xsl" type="text/xsl"?>

<xsp:page
 xmlns:xsp="http://www.apache.org/1999/XSP/Core"
 xmlns:test="http://www.mydomainname.com/test"
>
 <page>
    <title>Title Here</title>
    <section header="Section 1">
        <!-- I've got several tags that grab specific info from a
database -->
        <test:goGetSomeDatabaseInfo/>
        Plus I've got content in here...
    </section>
 </page>
</xsp:page>




test.xsp.xsl (Tag Library)
=================================================
<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xsp="http://www.apache.org/1999/XSP/Core"
   xmlns:test="http://www.mydomainname.com/test"
>
    <xsl:template match="xsp:page">
        <xsp:page>
            <xsl:apply-templates select="@*" />
           <xsl:apply-templates />
        </xsp:page>
    </xsl:template>

     <xsl:template match="@*|*|text()|processing-instruction()">
        <xsl:copy>
           <xsl:apply-templates
select="@*|*|text()|processing-instruction()"/>
        </xsl:copy>
     </xsl:template>

     <xsl:template match="test:goGetSomeDatabaseInfo">
         <xsp:expr>
               . . . . .
        </xsp:expr>
    </xsl:template>
    <!-- and a whole bunch more tags -->

</xsl:stylesheet>




test.fo.xsl
===============================================
<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">
        <xsl:processing-instruction name="cocoon-format">
            type="text/xslfo"
        </xsl:processing-instruction>
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
            <fo:layout-master-set>
                <fo:simple-page-master
                    page-master-name="one"
                    page-width="8.5in"
                    page-height="11in"
                    margin-top="0.5in"
                    margin-bottom="0.5in"
                    margin-left="0.5in"
                    margin-right="0.5in">
                    <fo:region-before extent="1in"/>
                    <fo:region-body
                    margin-top="0.5in"
                        margin-bottom="0.5in"
                        margin-right="0.5in"
                        margin-left="0.5in"/>
                    <fo:region-after extent="0.5in"/>
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence>
                <fo:sequence-specification>
                    <fo:sequence-specifier-repeating
                        page-master-first="one"
                        page-master-repeating="one"/>
                </fo:sequence-specification>
                <fo:static-content flow-name="xsl-after">
                    <fo:block text-align="end">
                        <fo:inline-graphic

href="file:/usr/local/tomcat/webapps/ROOT/images/Logo1.gif"
                            height="1cm"
                            width="2cm"/>
                    </fo:block>
                </fo:static-content>
                <fo:flow>
                    <fo:block text-align="start">
                        <fo:inline-graphic

href="file:/usr/local/tomcat/webapps/ROOT/images/titleLogo.gif"
                            width="6cm"
                            height="2cm"/>
                    </fo:block>
                    <xsl:apply-templates/>
                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>

    <xsl:template match="title">
        <fo:block font-size="18pt"
            font-family="sans-serif"
            text-align-last="centered"
            space-before.optimum="18pt">
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>

    <xsl:template match="p">
        <fo:block font-size="10pt"
            font-family="sans-serif"
            text-align-last="justify"
            space-before.optimum="12pt">
            <xsl:apply-templates/>
        </fo:block>
    </xsl:template>

    <!-- and a bunch more formatting definitions here --->

</xsl:stylesheet>





Re: FOP + Cocoon -- Inconsistent Response?

Posted by Scott Jones <sc...@izio.com>.
Hi everybody,

I just wanted to let you know that I've discovered that my application works
perfectly as soon as I stop embedding images into my PDF file...  Does that
make any sense at all?  (Again, I'm still using FOP 0.13 with Cocoon 1.8).

Thanks again for building such a sweet tool.  :)

Cheers,

Scott

----- Original Message -----
From: "Scott Jones" <sc...@izio.com>
To: <fo...@xml.apache.org>
Sent: Tuesday, October 31, 2000 9:34 PM
Subject: FOP + Cocoon -- Inconsistent Response?


> Hi,
>
> I'm generating a dynamic PDF file using a namespace taglib, and a XSL
> transform using FOP (I've got snippets of each file included below).
> However, I am struggling because I cannot seem to get my PDF get generated
> consistently...  Oftentimes, a request from the browser will time-out, but
> at other times, it works perfectly.  The page is dependant upon request
> variables, and when I send illegal values through the URL, it *always*
> causes a Cocoon error.  So, the problem occurs somewhere after the XSP
> processing, it seems...
>
> I have tried each of the Cocoon FAQ suggestions for getting IE to work
> correctly with FOP generated PDFs, but this problem is plaguing every
> browser that I have (and creating a servlet and/or changing the file
> extension to ".pdf" has not helped with the consistency).  This is running
> on a Redhat Linux 7 box with a PIII 600 CPU and 256 MB of RAM -- I've
> noticed that I'm using all of my memory (with just a few megs in swap).
> Could that be the problem?
>
> Thanks for any suggestions that anyone might have...
>
> I am using Cocoon 1.8, Tomcat 3.2 b6, FOP 0.13 (I didn't end up upgrading
to
> Tomcat 4, Cocoon 2 and the latest FOP CVS, just because I was nervous
about
> using so many bleeding edge components -- I need to go live with this
stuff
> in January!).  Thanks you!
>
> -Scott
>
>
> test.xml   (This file is about 13k or so total).
> ==========================================
> <?xml version="1.0"?>
>
> <?cocoon-process type="xsp"?>
> <?xml-logicsheet href="test.xsp.xsl"?>
> <?cocoon-process type="xslt"?>
> <?xml-stylesheet href="test.fo.xsl" type="text/xsl"?>
>
> <xsp:page
>  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>  xmlns:test="http://www.mydomainname.com/test"
> >
>  <page>
>     <title>Title Here</title>
>     <section header="Section 1">
>         <!-- I've got several tags that grab specific info from a
> database -->
>         <test:goGetSomeDatabaseInfo/>
>         Plus I've got content in here...
>     </section>
>  </page>
> </xsp:page>
>
>
>
>
> test.xsp.xsl (Tag Library)
> =================================================
> <?xml version="1.0"?>
>
> <xsl:stylesheet version="1.0"
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>    xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>    xmlns:test="http://www.mydomainname.com/test"
> >
>     <xsl:template match="xsp:page">
>         <xsp:page>
>             <xsl:apply-templates select="@*" />
>            <xsl:apply-templates />
>         </xsp:page>
>     </xsl:template>
>
>      <xsl:template match="@*|*|text()|processing-instruction()">
>         <xsl:copy>
>            <xsl:apply-templates
> select="@*|*|text()|processing-instruction()"/>
>         </xsl:copy>
>      </xsl:template>
>
>      <xsl:template match="test:goGetSomeDatabaseInfo">
>          <xsp:expr>
>                . . . . .
>         </xsp:expr>
>     </xsl:template>
>     <!-- and a whole bunch more tags -->
>
> </xsl:stylesheet>
>
>
>
>
> test.fo.xsl
> ===============================================
> <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">
>         <xsl:processing-instruction name="cocoon-format">
>             type="text/xslfo"
>         </xsl:processing-instruction>
>         <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
>             <fo:layout-master-set>
>                 <fo:simple-page-master
>                     page-master-name="one"
>                     page-width="8.5in"
>                     page-height="11in"
>                     margin-top="0.5in"
>                     margin-bottom="0.5in"
>                     margin-left="0.5in"
>                     margin-right="0.5in">
>                     <fo:region-before extent="1in"/>
>                     <fo:region-body
>                     margin-top="0.5in"
>                         margin-bottom="0.5in"
>                         margin-right="0.5in"
>                         margin-left="0.5in"/>
>                     <fo:region-after extent="0.5in"/>
>                 </fo:simple-page-master>
>             </fo:layout-master-set>
>             <fo:page-sequence>
>                 <fo:sequence-specification>
>                     <fo:sequence-specifier-repeating
>                         page-master-first="one"
>                         page-master-repeating="one"/>
>                 </fo:sequence-specification>
>                 <fo:static-content flow-name="xsl-after">
>                     <fo:block text-align="end">
>                         <fo:inline-graphic
>
> href="file:/usr/local/tomcat/webapps/ROOT/images/Logo1.gif"
>                             height="1cm"
>                             width="2cm"/>
>                     </fo:block>
>                 </fo:static-content>
>                 <fo:flow>
>                     <fo:block text-align="start">
>                         <fo:inline-graphic
>
> href="file:/usr/local/tomcat/webapps/ROOT/images/titleLogo.gif"
>                             width="6cm"
>                             height="2cm"/>
>                     </fo:block>
>                     <xsl:apply-templates/>
>                 </fo:flow>
>             </fo:page-sequence>
>         </fo:root>
>     </xsl:template>
>
>     <xsl:template match="title">
>         <fo:block font-size="18pt"
>             font-family="sans-serif"
>             text-align-last="centered"
>             space-before.optimum="18pt">
>             <xsl:apply-templates/>
>         </fo:block>
>     </xsl:template>
>
>     <xsl:template match="p">
>         <fo:block font-size="10pt"
>             font-family="sans-serif"
>             text-align-last="justify"
>             space-before.optimum="12pt">
>             <xsl:apply-templates/>
>         </fo:block>
>     </xsl:template>
>
>     <!-- and a bunch more formatting definitions here --->
>
> </xsl:stylesheet>
>
>
>