xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars Ivar Igesund <larsi...@igesundes.no>
Subject Re: Getting Mismatch: instream-foreign-object
Date Wed, 04 Oct 2006 16:23:13 GMT
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

Ok, by writing out the FO file, then try to create PDF directly from this, I
get these messages, not the ones above.

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;)+

Also, adding :svg to the svg xmlns above, lets FOP go on further, but of
course
now all the svg tags miss the svg namespace.

A cut down .fo file (created from my xsl) and that still exhibits these last
errors:

<?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>
									<path

d="M212.261,126.277c0,4.677-3.827,8.504-8.504,8.504H22.063c-4.677,0-8.504-3.8
27-8.504-8.504
 V56.733c0-4.677,3.827-8.504,8.504-8.504h181.694c4.677,0,8.504,3.827,8.504,8.
504V126.277z"

style="fill:#EFEFEF;" />
									<path

d="M212.261,126.277c0,4.677-3.827,8.504-8.504,8.504H22.063
c-4.677,0-8.504-3.827-8.504-8.504V56.733c0-4.677,3.827-8.504,8.504-8.504h181.
694c4.677,0,8.504,3.827,8.504,8.504V126.277z"

style="fill:none;stroke:#000000;" />
								</g>
								<g>
									<path

d="M212.261,212.904c0,4.677-3.827,8.504-8.504,8.504H22.063c-4.677,0-8.504-3.8
27-8.504-8.504
 V159.11c0-4.677,3.827-8.504,8.504-8.504h181.694c4.677,0,8.504,3.827,8.504,8.
504V212.904z"

style="fill:#EFEFEF;" />
									<path

d="M212.261,212.904c0,4.677-3.827,8.504-8.504,8.504H22.063
c-4.677,0-8.504-3.827-8.504-8.504V159.11c0-4.677,3.827-8.504,8.504-8.504h181.
694c4.677,0,8.504,3.827,8.504,8.504V212.904z"

style="fill:none;stroke:#000000;stroke-width:2;" />
								</g>
								<g>

<polygon

points="343.585,33.033 327.389,33.033 327.385,34.858 343.585,34.863 "

style="fill:#095BA6;" />

<polygon

points="386.878,33.021 386.878,34.852 394.205,34.852 394.192,0.002
383.228,0.002           383.23,36.365 370.951,16.717 381.491,0.002
370.347,0.002 365.536,7.635 360.766,0.002 349.081,0.002 359.585,16.816
347.245,36.396 347.245,24.815 336.666,24.809 336.666,22.431 345.418,22.428
345.418,12.416 336.666,12.41 336.666,10.021           347.245,10.018
 347.245,0 305.494,0.002 305.497,10.021 314.535,10.021 314.532,34.858
 325.558,34.856 325.558,10.021           332.967,10.021 332.967,8.19
 323.724,8.19
323.727,33.033 316.366,33.033 316.369,8.19 307.328,8.19 307.328,1.833
345.414,1.833 345.414,8.19 334.832,8.19 334.835,14.235 343.587,14.24
343.587,20.591 334.832,20.591 334.835,26.65           345.414,26.659
345.414,42.723 361.746,16.821 352.381,1.835 359.754,1.833 365.526,11.074
371.352,1.835 378.174,1.833           368.796,16.712 385.062,42.749
385.062,1.833 392.371,1.833 392.371,33.021 "

style="fill:#095BA6;" />

<polygon

points="376.812,33.033 371.126,33.033 365.544,24.1 359.914,33.033
353.683,33.033           352.531,34.858 360.922,34.862 365.539,27.539
370.112,34.858 377.955,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

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

-- 
Lars Ivar Igesund
Igesund Enterprise Software
+47 95076363
http://igesundes.no

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


Mime
View raw message