Error transform from xml xsl-fo to pdf
Posted: Wed Jun 08, 2011 11:36 am
Hi everybody!
i'm here because i'm in troble with oxygen =p
it's the first time i use it and i don't understand what i'm doing wrong.
i try to convert xml & xsl to a pdf doc without succes, i try it with samples from internet before learn xsl-fo.
For exemple:
i open an xml & an xsl file on oXygen (the contents are in french i hope it's not a problem for you^^):
xml
xsl
and when i process to the transformation fo pdf, i've got this error:
and this one:
is someone can make me understand why is not working? thanks for read this!
i'm here because i'm in troble with oxygen =p
it's the first time i use it and i don't understand what i'm doing wrong.
i try to convert xml & xsl to a pdf doc without succes, i try it with samples from internet before learn xsl-fo.
For exemple:
i open an xml & an xsl file on oXygen (the contents are in french i hope it's not a problem for you^^):
xml
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<CINEMA>
<NOM>Epée de bois</NOM>
<ADRESSE>100, rue Mouffetard</ADRESSE>
<METRO>Censier-Daubenton</METRO>
<SALLE NO='1' PLACES='320'>
<FILM>
<TITRE>Alien</TITRE>
<AUTEUR>Ridley Scott</AUTEUR>
<ANNEE>1979</ANNEE>
<GENRE>Science-fiction</GENRE>
<PAYS>Etats Unis</PAYS>
<RESUME>Près d'un vaisseau spatial échoué sur une lointaine
planète, des Terriens en mission découvrent de bien étranges
"oeufs". Ils en ramènent un à bord, ignorant qu'ils viennent
d'introduire parmi eux un huitième passager particulièrement
féroce et meurtrier.
</RESUME>
</FILM>
<REMARQUE>Réservation conseillée</REMARQUE>
<SEANCES>
<SEANCE>15:00</SEANCE>
<SEANCE>18:00</SEANCE>
<SEANCE>21:00</SEANCE>
</SEANCES>
</SALLE>
<SALLE NO='2' PLACES='120'>
<FILM>
<TITRE>Vertigo</TITRE>
<AUTEUR>Alfred Hitchcock</AUTEUR>
<ANNEE>1958</ANNEE>
<GENRE>Drame</GENRE>
<PAYS>Etats Unis</PAYS>
<RESUME>Scottie Ferguson, ancien inspecteur de police, est sujet
au vertige depuis qu'il a vu mourir son collègue. Elster, son
ami, le charge de surveiller sa femme, Madeleine, ayant des
tendances suicidaires. Amoureux de la jeune femme Scottie ne
remarque pas le piège qui se trame autour de lui et dont il va
être la victime...
</RESUME>
</FILM>
<SEANCES>
<SEANCE>22:00</SEANCE>
</SEANCES>
</SALLE>
<SALLE NO='3' PLACES='50'>
<FILM>
<TITRE>Sleepy Hollow</TITRE>
<AUTEUR>Tim Burton</AUTEUR>
<ANNEE>1999</ANNEE>
<GENRE>Fantastique</GENRE>
<PAYS>USA</PAYS>
<RESUME>Nouvelle Angleterre, 1799. A Sleepy Hollow, plusieurs
cadavres sont retrouvés décapités. La rumeur attribue ces
meurtres à un cavalier lui-même sans tête. Mais le fin limier
new-yorkais Ichabod Crane ne croit pas en ses
aberrations. Tombé sous le charme de la vénéneuse Katrina, il
mène son enquête au coeur des sortilèges de Sleepy
Hollow..
</RESUME>
</FILM>
<SEANCES>
<SEANCE>19:30</SEANCE>
<SEANCE>22:00</SEANCE>
</SEANCES>
</SALLE>
</CINEMA>
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- Définition des mises en page -->
<fo:layout-master-set>
<fo:simple-page-master master-name="page"
page-height="297mm" page-width="210mm"
margin-top="10mm" margin-bottom="10mm"
margin-left="20mm" margin-right="20mm">
<fo:region-body margin-top="15mm" margin-bottom="15mm"/>
<fo:region-before extent="20mm" />
<fo:region-after extent="10mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<!-- Définition du contenu -->
<fo:page-sequence master-reference="page">
<fo:flow flow-name='xsl-region-body' font-size="20pt">
<xsl:apply-templates select="CINEMA"/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template match="CINEMA">
<fo:block text-align="center">
<fo:block font-size="40pt" font-weight="bold" space-after="20pt">
<!-- Sélection du nom du cinema -->
<xsl:value-of select="NOM"/>
</fo:block>
<!-- Sélection de l'adresse du cinema -->
<xsl:value-of select="ADRESSE"/>
<!-- Sélection du métro près du cinema -->
(<xsl:value-of select="METRO"/>)
</fo:block>
<fo:block space-before="20pt">
<!-- Transformer chaque salle -->
<xsl:apply-templates select="SALLE"/>
</fo:block>
</xsl:template>
<xsl:template match="SALLE">
<fo:block text-align="center" space-before="40pt">
<fo:inline font-weight="bold" font-size="26pt">
<!-- Sélection du titre du film -->
<xsl:value-of select="FILM/TITRE"/>
</fo:inline> de
<fo:inline font-style="italic">
<!-- Sélection de l'auteur du film -->
<xsl:value-of select="FILM/AUTEUR"/>
</fo:inline>
<fo:block space-before="5pt">
<!-- Sélection de l'année et du pays du film -->
(<xsl:value-of select="FILM/PAYS"/>,
<xsl:value-of select="FILM/ANNEE"/>)
</fo:block>
</fo:block>
<fo:block space-before="10pt">
<!-- Sélection du résumé du film -->
<xsl:value-of select="FILM/RESUME"/>
</fo:block>
<fo:block space-before="10pt">
<fo:inline font-weight="bold">
<!-- Sélection du numéro de salle -->
Salle <xsl:value-of select="@NO"/>
</fo:inline>
(<xsl:value-of select="@PLACES"/> places) :
<!-- Sélection des séances -->
<xsl:for-each select="SEANCES/SEANCE">
<xsl:value-of select="."/> -
</xsl:for-each>
<!-- Sélection de la remarque -->
<xsl:value-of select="REMARQUE"/>
</fo:block>
</xsl:template>
</xsl:stylesheet>
Code: Select all
SystemID: C:\Temp\Essaie xml xsl fo\test xml xsl fo\cinema.xml
Description: The process 'FOP' ended with code: 1.
The error was:
8 juin 2011 09:32:10 org.apache.fop.cli.Main startFOP
GRAVE: Exception
net.sf.saxon.trans.XPathException: org.apache.fop.fo.ValidationException: Error: First element must be the fo:root formatting object. Found (Namespace URI: "", Local Name: "CINEMA") instead. Please make sure you're producing a valid XSL-FO document.
at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:168)
at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
at org.apache.fop.cli.Main.startFOP(Main.java:166)
at org.apache.fop.cli.Main.main(Main.java:197)
---------
net.sf.saxon.trans.XPathException: org.apache.fop.fo.ValidationException: Error: First element must be the fo:root formatting object. Found (Namespace URI: "", Local Name: "CINEMA") instead. Please make sure you're producing a valid XSL-FO document.
at net.sf.saxon.event.ContentHandlerProxy.handleSAXException(ContentHandlerProxy.java:521)
at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:375)
at net.sf.saxon.event.NamespaceReducer.startContent(NamespaceReducer.java:197)
at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:364)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:371)
at net.sf.saxon.event.Sender.send(Sender.java:185)
at net.sf.saxon.IdentityTransformer.transform(IdentityTransformer.java:29)
at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:165)
at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
at org.apache.fop.cli.Main.startFOP(Main.java:166)
at org.apache.fop.cli.Main.main(Main.java:197)
Caused by: org.apache.fop.fo.ValidationException: Error: First element must be the fo:root formatting object. Found (Namespace URI: "", Local Name: "CINEMA") instead. Please make sure you're producing a valid XSL-FO document.
at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:292)
at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:185)
at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:362)
... 19 more
---------
org.apache.fop.fo.ValidationException: Error: First element must be the fo:root formatting object. Found (Namespace URI: "", Local Name: "CINEMA") instead. Please make sure you're producing a valid XSL-FO document.
at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:292)
at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:185)
at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:362)
at net.sf.saxon.event.NamespaceReducer.startContent(NamespaceReducer.java:197)
at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:364)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:371)
at net.sf.saxon.event.Sender.send(Sender.java:185)
at net.sf.saxon.IdentityTransformer.transform(IdentityTransformer.java:29)
at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:165)
at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
at org.apache.fop.cli.Main.startFOP(Main.java:166)
at org.apache.fop.cli.Main.main(Main.java:197)
Code: Select all
SystemID: C:\Temp\Essaie xml xsl fo\test xml xsl fo\cinema1.xsl
Description: The process 'FOP' ended with code: 1.
The error was:
8 juin 2011 09:32:11 org.apache.fop.cli.Main startFOP
GRAVE: Exception
net.sf.saxon.trans.XPathException: org.apache.fop.fo.ValidationException: Error: First element must be the fo:root formatting object. Found (Namespace URI: "http://www.w3.org/1999/XSL/Transform", Local Name: "stylesheet") instead. Please make sure you're producing a valid XSL-FO document.
at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:168)
at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
at org.apache.fop.cli.Main.startFOP(Main.java:166)
at org.apache.fop.cli.Main.main(Main.java:197)
---------
net.sf.saxon.trans.XPathException: org.apache.fop.fo.ValidationException: Error: First element must be the fo:root formatting object. Found (Namespace URI: "http://www.w3.org/1999/XSL/Transform", Local Name: "stylesheet") instead. Please make sure you're producing a valid XSL-FO document.
at net.sf.saxon.event.ContentHandlerProxy.handleSAXException(ContentHandlerProxy.java:521)
at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:375)
at net.sf.saxon.event.NamespaceReducer.startContent(NamespaceReducer.java:197)
at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:364)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:371)
at net.sf.saxon.event.Sender.send(Sender.java:185)
at net.sf.saxon.IdentityTransformer.transform(IdentityTransformer.java:29)
at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:165)
at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
at org.apache.fop.cli.Main.startFOP(Main.java:166)
at org.apache.fop.cli.Main.main(Main.java:197)
Caused by: org.apache.fop.fo.ValidationException: Error: First element must be the fo:root formatting object. Found (Namespace URI: "http://www.w3.org/1999/XSL/Transform", Local Name: "stylesheet") instead. Please make sure you're producing a valid XSL-FO document.
at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:292)
at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:185)
at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:362)
... 19 more
---------
org.apache.fop.fo.ValidationException: Error: First element must be the fo:root formatting object. Found (Namespace URI: "http://www.w3.org/1999/XSL/Transform", Local Name: "stylesheet") instead. Please make sure you're producing a valid XSL-FO document.
at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:292)
at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:185)
at net.sf.saxon.event.ContentHandlerProxy.startContent(ContentHandlerProxy.java:362)
at net.sf.saxon.event.NamespaceReducer.startContent(NamespaceReducer.java:197)
at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:364)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:371)
at net.sf.saxon.event.Sender.send(Sender.java:185)
at net.sf.saxon.IdentityTransformer.transform(IdentityTransformer.java:29)
at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:165)
at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
at org.apache.fop.cli.Main.startFOP(Main.java:166)
at org.apache.fop.cli.Main.main(Main.java:197)