You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gil Winkelman <gi...@excite.com> on 2001/01/23 22:53:15 UTC

Esql and FOP

Hello All,

I have a question about using  and I'm not sure why this isn't working. I
have an xml file, report.xml that uses a JavaBean to dynamically create a
query and use esql to get the results. If I run that using my
report-html.xsl stylesheet it works fine. But when I try to go to PDF using
report-fo.xsl it doesn't work. I don't get an error but depending upon the
following line I either get  a PDF file, acrobat runs in IE, or I get the
data streamed to IE and outputted without any formatting. 

This is the switch:
<xsl:processing-instruction
name="cocoon-format">type="text/xslfo"</xsl:processing-instruction>
if this is in place, I get the heading showing up and nothing else. 

On the other hand, if report.xml doesn't use the JavaBean to create the
query string dynamically it works just fine. What is the deal here? 


My other question on this is that I am using the Java Bean to create the
query string because there is some business logic in determining the
parameters. I'd rather separate that out from the page and shield if from
the non-programmers. If anyone has suggestions on handling this within the
context of the xsp page that would be welcome as well. 

TIA,

Gil




<xsl:stylesheet
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
     xmlns:fo="http://www.w3.org/1999/XSL/Format"
>
 <xsl:template match="page">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:processing-instruction
name="cocoon-format">type="text/xslfo"</xsl:processing-instruction>
<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:static-content flow-name="xsl-region-before">
		<fo:block text-align="center" font-size="20pt">
			Nothing
		</fo:block>
	</fo:static-content>

        <fo:static-content flow-name="xsl-region-after">
          <fo:block text-align-last="center" font-size="10pt">p.
		<fo:page-number/></fo:block>
        </fo:static-content>

        <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-cell>
       <fo:block><xsl:value-of select="initDate"/></fo:block>
      </fo:table-cell>

      <fo:table-cell>
       <fo:block><xsl:value-of select="admNum"/></fo:block>
      </fo:table-cell>
      
      <fo:table-cell>
       <fo:block><xsl:value-of select="fabric"/></fo:block>
      </fo:table-cell>
      
      <fo:table-cell>
       <fo:block><xsl:value-of select="supplierName"/></fo:block>
      </fo:table-cell>
      
      <fo:table-cell>
       <fo:block><xsl:value-of select="colorName"/></fo:block>
      </fo:table-cell>
      
</fo:table-row>

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

 </fo:root>
  </xsl:template>

<xsl:template match="heading">
<fo:block text-align-last="center" font-size="16pt"
space-before.optimum="24pt">
		Country
	</fo:block>

	<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='colorist'/></fo:block>
		</fo:table-cell>
		
		<fo:table-cell>
			<fo:block></fo:block>
		</fo:table-cell>
		
		<fo:table-cell>
			<fo:block></fo:block>
		</fo:table-cell>

		<fo:table-cell>
			<fo:block></fo:block>
		</fo:table-cell>

		<fo:table-cell>
			<fo:block></fo:block>
		</fo:table-cell>

		<fo:table-cell>
			<fo:block><xsl:value-of select='date'/></fo:block>
		</fo:table-cell>
	</fo:table-row>	

     <fo:table-row>
      <fo:table-cell>
       <fo:block font-weight="bold">Supplier</fo:block>
      </fo:table-cell>
        <fo:table-cell>
       <fo:block font-weight="bold">Initial Request Date</fo:block>
      </fo:table-cell>
      <fo:table-cell>
       <fo:block font-weight="bold">ADM #</fo:block>
      </fo:table-cell>
      <fo:table-cell>
       <fo:block font-weight="bold">Fabric Name</fo:block>
      </fo:table-cell>
      <fo:table-cell>
       <fo:block font-weight="bold">Supplier Item Number</fo:block>
      </fo:table-cell>
      <fo:table-cell>
       <fo:block font-weight="bold">Color</fo:block>
      </fo:table-cell>
     </fo:table-row>
    </fo:table-body>
   </fo:table>
  </xsl:template>

</xsl:stylesheet>





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



Re: Esql and FOP

Posted by Donald Ball <ba...@webslingerZ.com>.
On Tue, 23 Jan 2001, Gil Winkelman wrote:

> Hello All,
>
> I have a question about using  and I'm not sure why this isn't working. I
> have an xml file, report.xml that uses a JavaBean to dynamically create a
> query and use esql to get the results. If I run that using my
> report-html.xsl stylesheet it works fine. But when I try to go to PDF using
> report-fo.xsl it doesn't work. I don't get an error but depending upon the
> following line I either get  a PDF file, acrobat runs in IE, or I get the
> data streamed to IE and outputted without any formatting.
>
> This is the switch:
> <xsl:processing-instruction
> name="cocoon-format">type="text/xslfo"</xsl:processing-instruction>
> if this is in place, I get the heading showing up and nothing else.
>
> On the other hand, if report.xml doesn't use the JavaBean to create the
> query string dynamically it works just fine. What is the deal here?

couldn't say. some problem with the formatter, it would seem, but that's
beyond my purview. esql shouldn't have anything to do with this.

> My other question on this is that I am using the Java Bean to create the
> query string because there is some business logic in determining the
> parameters. I'd rather separate that out from the page and shield if from
> the non-programmers. If anyone has suggestions on handling this within the
> context of the xsp page that would be welcome as well.

sure, write a logicsheet to transform the call from an element in your own
namespace to the xsp logic or expr elements that actually do the work:

<my:sales-reports/>

turns into

<esql:connection>
  ...
  <esql:execute-query>
    <esql:query><xsp:expr>Bean.getSalesReportQuery()</xsp:expr></esql:query>
    ...
  </esql:execute-query>
</esql:connection>

make sense?

- donald