You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Philipp Rech <re...@iuw.fh-darmstadt.de> on 2005/01/13 12:02:57 UTC

sql-transformer output to pdf via xsl-fo doen't work

Hello Cocooners,

[Cocoon Version 2.1.6]

i have a xml file that comes from a sql-transformer that querries a db...
here is the xml file:

----------------------------------------------------------------------

<?xml version="1.0" encoding="ISO-8859-1"?>
<page>
	<content>
		<rowset xmlns:sql="http://apache.org/cocoon/SQL/2.0"
xmlns="http://apache.org/cocoon/SQL/2.0">
			<row>
				<eventid>3</eventid>
				<typeofcontrol>Control Type A</typeofcontrol>
				<trafficdirection>Entry</trafficdirection>
				<checkpoint>Blue Border</checkpoint>
				<klassification>illigal</klassification>
				<checklocation>black sea</checklocation>
				<guard_1>Philipp</guard_1>
				<guard_2>Peter Pan</guard_2>
				<objection>test</objection>
				<dtg>2005-01-01</dtg>
				<location>black sea</location>
				<description/>
				<numberofpersons>3</numberofpersons>
				<observed>Yes</observed>
			</row>
			<row>
				<eventid>2</eventid>
				<typeofcontrol>Control Type B</typeofcontrol>
				<trafficdirection>Leave</trafficdirection>
				<checkpoint>Airport</checkpoint>
				<klassification>illigal entry</klassification>
				<checklocation>airport</checklocation>
				<guard_1>Philipp</guard_1>
				<guard_2>Stephan</guard_2>
				<objection>illigal enrty</objection>
				<dtg>2005-01-12</dtg>
				<location>airport somewhere</location>
				<description>test</description>
				<numberofpersons>1</numberofpersons>
				<observed>No</observed>
			</row>
		</rowset>
	</content>
</page>

---------------------------------------------------------------------------

now i transform it into a pdf amd encounter this problem
if i select all tags with
---------------------------------------------------------------------------
<xsl:template match="/*"> 
    <fo:block font-size="26pt" space-before.optimum="24pt"
text-align="center"><xsl:value-of select="."/></fo:block> 
  </xsl:template>
---------------------------------------------------------------------------
a pdf opens with all data in it, (so far so good) 
but there are not seperatet which 
makes sence because there in the same fo:block...
if i write one template for each tag like:

<xsl:template match="eventid"> 
    <fo:block font-size="36pt" space-before.optimum="24pt"
text-align="center"><xsl:apply-templates/></fo:block> 
  </xsl:template> 

  <xsl:template match="typeofcontrol"> 
    <fo:block font-size="12pt" space-before.optimum="12pt"
text-align="center"><xsl:apply-templates/></fo:block> 
  </xsl:template> 

i get the error: 
------------------------------------------------------------------
org.apache.cocoon.ProcessingException: Error executing pipeline.:
java.lang.RuntimeException: org.apache.fop.apps.FOPException: fo:flow must
contain block-level children
-------------------------------------------------------------------

what can i do?

here is my complete xsl-fo file:

----------------------------------------
<?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="/"> 
   <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> 
    
    <fo:layout-master-set> 
     <fo:simple-page-master master-name="page" 
                  page-height="29.7cm" 
                  page-width="21cm" 
                  margin-top="1cm" 
                  margin-bottom="2cm" 
                  margin-left="2.5cm" 
                  margin-right="2.5cm"> 
       <fo:region-before extent="3cm"/> 
       <fo:region-body margin-top="3cm"/> 
       <fo:region-after extent="1.5cm"/> 
     </fo:simple-page-master> 

     <fo:page-sequence-master master-name="all"> 
       <fo:repeatable-page-master-alternatives> 
    <fo:conditional-page-master-reference master-reference="page"
page-position="first"/> 
       </fo:repeatable-page-master-alternatives> 
     </fo:page-sequence-master> 
    </fo:layout-master-set> 

    <fo:page-sequence master-reference="all"> 
      <fo:static-content flow-name="xsl-region-after"> 
   <fo:block text-align="center" 
             font-size="10pt" 
        font-family="serif" 
        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="eventid"> 
    <fo:block font-size="36pt" space-before.optimum="24pt"
text-align="center"><xsl:apply-templates/></fo:block> 
  </xsl:template> 

  <xsl:template match="typeofcontrol"> 
    <fo:block font-size="12pt" space-before.optimum="12pt"
text-align="center"><xsl:apply-templates/></fo:block> 
  </xsl:template> 
</xsl:stylesheet>

----------------------------------------



Thank you very much for your help!
phil

-- 

    

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


[SOLVED] sql-transformer output to pdf via xsl-fo doen't work

Posted by Philipp Rech <re...@iuw.fh-darmstadt.de>.
thank you so much Bertrand - it works fine now
when i use the namespace like  
<xsl:template match="sql:eventid">
thank you!

philipp


> > ...java.lang.RuntimeException: org.apache.fop.apps.FOPException: 
> > fo:flow must
> > contain block-level children...
> 
> Looks like this stays empty
> 
> >       <fo:flow flow-name="xsl-region-body">
> >         <xsl:apply-templates/>
> >       </fo:flow>
> 
> IIUC because your eventid element, for example, is in the SQL 
> namespace, because its ancestor is <rowset  
> ...xmlns="http://apache.org/cocoon/SQL/2.0">
> 
> So you must declare this namespace in your XSLT:
> 
> <xsl:stylesheet version="1.0"
> ...
> xmlns:sql="http://apache.org/cocoon/SQL/2.0"
>  >
> 
> And then match using this namespace like
> >   <xsl:template match="sql:eventid">
> 
> Note that debugging with views in the sitemap (or temporarily setting 
> an xml serializer instead of the fo2pdf one) would allow you to see the exact
XML that is passed to FOP, to find such problems.
> 
> -Bertrand
> 
> 
-- 

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


Re: sql-transformer output to pdf via xsl-fo doen't work

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 13 janv. 05, à 12:02, Philipp Rech a écrit :

> ...java.lang.RuntimeException: org.apache.fop.apps.FOPException: 
> fo:flow must
> contain block-level children...

Looks like this stays empty

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

IIUC because your eventid element, for example, is in the SQL 
namespace, because its ancestor is <rowset  
...xmlns="http://apache.org/cocoon/SQL/2.0">

So you must declare this namespace in your XSLT:

<xsl:stylesheet version="1.0"
...
xmlns:sql="http://apache.org/cocoon/SQL/2.0"
 >

And then match using this namespace like
>   <xsl:template match="sql:eventid">

Note that debugging with views in the sitemap (or temporarily setting 
an xml serializer instead of the fo2pdf one) would allow you to see the 
exact XML that is passed to FOP, to find such problems.

-Bertrand