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 Gil Winkelman <gi...@excite.com> on 2001/01/25 02:37:16 UTC

Problem with FOP 0.15 in Cocoon and sql

Hello All,

I have posted this to cocoon but believe it to be a FOP problem; I apologize
in advance for any duplication. 
I have an XSP/XML page that uses a bean to create the queryString. I then
use <xsp:expr>queryString</xsp:expr> within the esql:query tag to get the
data. If I go to an HTML based xsl (html.xsl) it works fine. If I hardcode
the sql in my xsp/xml file and go to PDF based xsl (fo.xsl) it works fine. 

The problem I am having is that when I use a XSP that builds a SQL Query
dynamically and then call my fo.xsl page I don't get any results. The reason
is that for some reason the fo.xsl page calls the bean function
getQueryString() a second time after it is called.  I don't know why it is
being called a second time because it does not get called if I embed the
same query in my xml page. By getting called the second time, I get no data
returned. 

Any ideas? 


Here's the code. The only thing I can think of is that the
processing-instruction may be throwing things off. 

==============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"
  xmlns:labdip="http://www.columbia.com/labdip">

  <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
       master-name="only"
         page-width="11in"  page-height="8.5in"
	      margin-top="0.25in"  margin-bottom="0.25in" 
      	      margin-left="0.5in" margin-right="0.5in">  
      	    <fo:region-before extent="1.0cm"/>
  			<fo:region-body margin-top="1.0cm" margin-bottom="1.0cm"/>
      		<fo:region-after extent="1.5cm"/>          
      </fo:simple-page-master>
</fo:layout-master-set>
	<fo:page-sequence initial-page-number="1" master-name="only">
...
...

        <fo:flow flow-name="xsl-region-body">
        	<xsl:apply-templates select="heading"/>
			<xsl:for-each select="requests">
 				<fo:table text-align="center">
    			<fo:table-column column-width="60mm"/>
    			<fo:table-column column-width="30mm"/>  
    			<fo:table-column column-width="30mm"/>   
    			<fo:table-column column-width="40mm"/>
    			<fo:table-column column-width="60mm"/> 
    			<fo:table-column column-width="40mm"/>   
			<fo:table-body>
			<fo:table-row>

 	<fo:table-cell>
       <fo:block><xsl:value-of select="supplier"/></fo:block>
      </fo:table-cell>
      
	...
....
....      
</fo:table-row>

    </fo:table-body>
   </fo:table>
</xsl:for-each>
        </fo:flow>
     </fo:page-sequence>
....
....

===================XML==================
?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet href="requestReport-fo.xsl" type="text/xsl"?>
<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<xsp:page
  language="java"
  xmlns:esql="http://apache.org/cocoon/SQL/v2"
  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
  xmlns:request="http://www.apache.org/1999/XSP/Request"
>

<page>
<xsp:logic>
	CreateQueryBean queryBean = new CreateQueryBean();
        String queryString = queryBean.buildQueryString(request, response);
</xsp:logic>
<heading/>
<rowset/>
<esql:connection>
<esql:pool>default</esql:pool>
  <esql:execute-query>
    <esql:query>
   <xsp:expr>queryString</xsp:expr>
   </esql:query>
    <esql:results>
      <header>Requests LabDip Report</header>
      <esql:row-results>
        <requests>
          <supplier><esql:get-string column="sup_nm"/></supplier>
<rowNumber><esql:get-row-position/></rowNumber>
        </requests>
      </esql:row-results>
      <footer></footer>
    </esql:results> 
    <esql:error-results>
  <message><esql:get-message/></message>
  <stacktrace><esql:get-stacktrace/></stacktrace>
</esql:error-results>
  </esql:execute-query>
</esql:connection>
</page>
</xsp:page>
===================

TIA,
Gil Winkelman
(503)872-9583
gil@intuitek.com





_______________________________________________________
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/



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