You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <DH...@csir.co.za> on 2005/01/13 13:53:51 UTC

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

Phil

Not a guru in this (FO) - but have you got XSL templates to match
each of the different element tags in your original XML (even the ones
that seem empty)?

Derek

>>> rech@iuw.fh-darmstadt.de 2005/01/13 01:02:57 PM >>>
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 


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