On Thursday 05 October 2006 16:59, Lars Ivar Igesund wrote:
> Pascal Sancho <pascal.sancho <at> takoma.fr> writes:
> > > -----Original Message-----
> > > From: Lars Ivar Igesund [mailto:larsivar <at> igesund.net]
> > > Sent: Wednesday, October 04, 2006 2:04 PM
> > > To: fop-users <at> xmlgraphics.apache.org
> > > Subject: Getting Mismatch: instream-foreign-object
> > >
> > > I am trying to create a PDF-document by taking a xml document
> > > and put it through the transformer using xslt and fop, like this:
> > >
> > >         File xsltfile = new File(baseDir, xslFile);
> > >         File pdffile = new File(outDir, fileName);
> > >
> > >         FopFactory fopFactory = FopFactory.newInstance();
> > >         FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
> > >
> > >         try {
> > >           OutputStream out = new BufferedOutputStream(new
> > > FileOutputStream(pdffile));
> > >
> > >             Fop fop =
> > > fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
> > >
> > >             TransformerFactory factory =
> > > TransformerFactory.newInstance();
> > >             Transformer transformer =
> > > factory.newTransformer(new StreamSource(xsltfile));
> > >
> > >             transformer.setParameter("versionParam", "2.0");
> > >
> > >             // Setup input for XSLT transformation, src from
> > > servicemix
> > >             Source src = message.getContent();
> > >
> > >             Result res = new SAXResult(fop.getDefaultHandler());
> > >
> > >             // Start XSLT transformation and FOP processing
> > >             transformer.transform(src, res);
> > >         }
> > >
> > > Most of the document consists of SVG graphics.
> > >
> > > The resulting FO document seems to be correct, but I get
> > > these messages on the
> > > console:
> > >
> > > WARN  - FOTreeBuilder                  - Mismatch:
> > > instream-foreign-object
> > > (http://www.w3.org/1999/XSL/Format) vs. svg
> > > (http://www.w3.org/2000/svg)
> > > WARN  - FOTreeBuilder                  - Mismatch:
> > > instream-foreign-object
> > > (http://www.w3.org/1999/XSL/Format) vs. block
> > > (http://www.w3.org/1999/XSL/Format)
> > > WARN  - FOTreeBuilder                  - Mismatch:
> > > instream-foreign-object
> > > (http://www.w3.org/1999/XSL/Format) vs. flow
> > > (http://www.w3.org/1999/XSL/Format)
> > > WARN  - FOTreeBuilder                  - Mismatch:
> > > instream-foreign-object
> > > (http://www.w3.org/1999/XSL/Format) vs. page-sequence
> > > (http://www.w3.org/1999/XSL/Format)
> > > WARN  - FOTreeBuilder                  - Mismatch:
> > > instream-foreign-object
> > > (http://www.w3.org/1999/XSL/Format) vs. root
> > > (http://www.w3.org/1999/XSL/Format)
> > > (Location of error unknown)org.apache.fop.apps.FOPException:
> > > Error(Unknown
> > > location): No element mapping definition found for svg:svg
> > >
> > > I use the 0.92beta version.
> > >
> > > Where (or what) is the mismatch? I am fairly new to XSLT and
> > > FO, but my xsl file is based on (lots of cut'n'paste) one
> > > that used to work with the old stable releases of FOP.
> > >
> > > The instream svg starts like this in the xsl file:
> > >
> > > <fo:instream-foreign-object>
> > >   <svg xmlns="http://www.w3.org/2000/svg";
> > > xmlns:xlink="http://www.w3.org/1999/xlink"; width="425.197"
> > >                                   height="563.19"
> > > viewBox="0 0 765 1013">
> > >
> > >
> > > Regards,
> > > Lars Ivar Igesund
> >
> > Hi,
> > Can you give a simple XSL-FO file (not XSLT) that demonstrates what
> > you describe here?
> >
> > Pascal
>
> I seem to get several problems, depending on exactly how I do it.
> Changing SVG xmlns above to xmlns:svg let's FOP continue past the
> point where the above error occurs, but of course then none of the
> SVG tags are recognized because they're not prefixed with svg:
> Prefixing everything with svg: seems to not be a solution either.
>
> I then wrote the resulting .fo to file (pasted further down, most of
> svg cut away here, but the message is the same), then tried to create
> the PDF directly from that. This however did not work either, and now
> with a different message...

The fo below works just fine for me. No errors parsing, etc.. This is 
with the trunk version of fop, xerces xml parser and jdk 1.5.0_06.

What is your environment?
>
> WARN  - FOTreeBuilder                  - Mismatch: flow
> (http://www.w3.org/1999/XSL/Format) vs. page-sequence
> (http://www.w3.org/1999/XSL/Format)
> WARN  - FOTreeBuilder                  - Mismatch: flow
> (http://www.w3.org/1999/XSL/Format) vs. root
> (http://www.w3.org/1999/XSL/Format)
> (Location of error unknown)org.apache.fop.fo.ValidationException:
> Error(Unknown location): fo:flow is missing child elements.
> Required Content Model: marker* (%block;)+
>
> The resulting .fo file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>       xmlns:svg="http://www.w3.org/2000/svg";
>       xmlns:fn="http://www.w3.org/2005/02/xpath-functions";>
>       <fo:layout-master-set>
>               <fo:simple-page-master margin-bottom="0cm" margin-right="0cm"
>                       margin-left="0cm" margin-top="0cm" page-width="21cm"
>                       page-height="29.1cm" master-name="simple">
>                       <fo:region-body margin-right="1cm" margin-left="1cm"
>                               margin-bottom="1cm" margin-top="1cm" />
>                       <fo:region-before display-align="before"
> extent="0.5cm" />
>                       <fo:region-after display-align="after"
> extent="0.5cm" />
>               </fo:simple-page-master>
>       </fo:layout-master-set>
>       <fo:page-sequence master-reference="simple">
>               <fo:flow flow-name="xsl-region-body">
>
>                       <fo:block border-color="black" border-width="1mm"
>                               text-align="center">
>                               <fo:instream-foreign-object>
>                                       <svg xmlns="http://www.w3.org/2000/svg";
>                         xmlns:xlink="http://www.w3.org/1999/xlink";
>                         viewBox="0 0 765 1013"
>                                               height="563.19"
> width="425.197">
>                                               <g transform="scale(1.8)">
>                                                       <g id="Layer_1">
>                                                               <g>
>
> <polygon
> points="343.585,33.033 327.389,33.033 327.385,34.858 343.585,34.863 "
> style="fill:#095BA6;" />
>                                                               </g>
>                                                       </g>
>                                               </g>
>                                       </svg>
>                               </fo:instream-foreign-object>
>                       </fo:block>
>
>               </fo:flow>
>       </fo:page-sequence>
> </fo:root>
>
> Regards,
> Lars Ivar Igesund
>
Cheers

Manuel

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to