You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Tom Place <ps...@nottingham.ac.uk> on 2003/02/06 10:58:28 UTC

XSL FO

Hi all,

I am new to XSL FO and have been working through some tutorials.

I have successfully managed to create the Fop font xml files and
config.xml file for the folder, and have setup cocoons sitemap so the
fo2pdf serializer find the config file. 

However the problem comes when I try to parse simple XML through an XSL
template and serialize it as PDF. I think the error lies in my XSL
however after following several examples to the letter I'm tearing my
hair out! The XML, XSL and Error are outlined below:

<!--++++++++++++++++++++++++++++++++++++++++++++++++-->
<!-- Sample simple XML below : -->
<?xml version="1.0"?>
<page>
  <main>
    <item>
      <title>HELLO WORLD!</title>
      <body>PDF is getting on my wick</body>
    </item>
  </main>
</page>

<!--++++++++++++++++++++++++++++++++++++++++++++++++-->
<!-- Sample XSL below : -->
<?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 = "first">
	  <fo:region-body margin-top="1in"
                          margin-bottom="1in"
                          margin-left="1.5in"
		          margin-right="1.5in"/>
          <fo:region-before extent="1in"
                            margin-top="0.2in"
                            margin-bottom="0.2in"
	                    margin-left="0.2in"
		            margin-right="0.2in"/>
        </fo:simple-page-master>

        <fo:page-sequence-master master-name = "run1">
          <fo:single-page-master-reference 
                          master-name = "first"/>
	</fo:page-sequence-master>

      </fo:layout-master-set>

      <fo:page-sequence master-name = "run1">   
        <xsl:apply-templates/>
      </fo:page-sequence>

    </fo:root>

  </xsl:template>
  
  <xsl:template match="page">

    <fo:static-content flow-name="xsl-region-before">
      <fo:block font-size="10pt"
                line-height="12pt"
                font-family="Arial"
                text-align="center">
        Page <fo:page-number/>
      </fo:block>
    </fo:static-content>

    <fo:flow flow-name="xsl-body">
      <xsl:for-each select="main/item">

        <fo:block font-size="10pt"
                  line-height="12pt"
                  font-family="Arial"
                  text-align="center"
                  font-weight="bold">
          <xsl:value-of select="title"/>
        </fo:block>

        <fo:block font-size="10pt"
                  line-height="12pt"
                  font-family="Arial"
                  text-align="center">
          <xsl:value-of select="body"/>
        </fo:block>
 
      </xsl:for-each>     
    </fo:flow>
    
  </xsl:template>

</xsl:stylesheet>

<!--++++++++++++++++++++++++++++++++++++++++++++++++-->
<!-- Print of the error below : -->
<!-- This error is generated by the tomcat window-->
java.lang.RuntimeException: Errors in XSLT transformation:
Fatal: org.apache.for.apps.FOPException: 'master-referance' for
'fo:page-sequence matches no 'simple-page-master' or
'page-sequence-master'

   at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:31
70)
   at java.lang.Thread.run(Thread.java:536)

<!--++++++++++++++++++++++++++++++++++++++++++++++++-->

The error I get from Acrobat in "File damaged!"

If anyone can spot the error it would be most appreciated however as I
say this has been copied CLOSELY from a textbook so I'm at a loss

Cheers

Tom Place
 



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: XSL FO

Posted by Perry Molendijk <xi...@iinet.net.au>.
You probably got caught out with an older version of FOP before.
This:

      <fo:page-sequence master-name = "run1">   
        <xsl:apply-templates/>
      </fo:page-sequence>

should read:

      <fo:page-sequence master-reference = "run1">   
        <xsl:apply-templates/>
      </fo:page-sequence>

Bye,

Perry Molendijk

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: XSL FO

Posted by Mike Haarman <mh...@socsci.umn.edu>.
On Thu, 6 Feb 2003, J.Pietschmann wrote:

> Tom Place wrote:
>
> > <!-- This error is generated by the tomcat window-->
> > java.lang.RuntimeException: Errors in XSLT transformation:
> > Fatal: org.apache.for.apps.FOPException: 'master-referance' for
> > 'fo:page-sequence matches no 'simple-page-master' or
> > 'page-sequence-master'

You have a discrepancy between the @master-name(s) of your page-masters
and the name you are using to reference them in the @master-reference of
your page-sequence.

> It is also recommended to use the FOP CLI for initial development
> of the style sheet and deploy to Cocoon only after some debugging.
> You'll get better error messages.
>
> J.Pietschmann

I second.

Mike

----------------------------------------------------------------
Mike Haarman
mhaarma@socsci.umn.edu


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: XSL FO

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Tom Place wrote:
> I am new to XSL FO and have been working through some tutorials.

Keep in mind that most of the tutorials have been written
before the XSLFO spec went REC status and have not been updated
to the final spec.

> <!-- This error is generated by the tomcat window-->
> java.lang.RuntimeException: Errors in XSLT transformation:
> Fatal: org.apache.for.apps.FOPException: 'master-referance' for
> 'fo:page-sequence matches no 'simple-page-master' or
> 'page-sequence-master'
...
> If anyone can spot the error it would be most appreciated however as I
> say this has been copied CLOSELY from a textbook so I'm at a loss

Even recent textbooks have errors. In case of doubt
1. Read the FO spec.
2. Ask on the fop-user list.

It is also recommended to use the FOP CLI for initial development
of the style sheet and deploy to Cocoon only after some debugging.
You'll get better error messages.

J.Pietschmann


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>