W3C home > Mailing lists > Public > www-xsl-fo@w3.org > April 2003

external-graphic src="url(...)"

From: Koch, Anthony <Anthony.Koch@cognos.com>
Date: Wed, 9 Apr 2003 17:01:39 -0400
Message-ID: <BF85C64585F2D61190EF0002A5CE6F34015087AA@sottexch2.cognos.com>
To: "'www-xsl-fo@w3.org'" <www-xsl-fo@w3.org>
Hi,

I'm having trouble referencing SVG within my XSL:FO, where the SVG is
returned from an URL.

            <fo:block>            
               <fo:external-graphic
src="url('http://localhost:8080/application/graphics/svggen')"/>
               <!-- or trying src="url('graphics/svggen') -->
            </fo:block>

When I go to http://localhost:8080/application/graphics/svggen, the
following SVG is returned:

		<?xml version="1.0" encoding="UTF-8" ?> 
		<svg width="619.0" height="288.0"
xmlns:xsp="http://apache.org/xsp"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"> 
		     <text x="30" y="14"
style="fill:#ff0000;font-size:16;font-family:Arial"
text-anchor="middle">some text<text> 
		</svg>

Note, svggen is an XSP that returns the above SVG XML using Cocoon
framework. The XSL:FO transformation
is applied to XML, as defined in the Cocoon pipeline:
			   <map:generate src="testpdf.xml"/>
                                                   <map:transform
src="testpdf.xsl"/>
                                                   <map:serialize
type="fo2pdf"/>

Everything works fine if the SVG is instream :
			<fo:block text-align="left">
				<fo:instream-foreign-object
xmlns:svg="http://www.w3.org/2000/svg">
					<svg:svg width="45" height="45">
						<svg:g style="fill:green;
stroke-width:7">
							<svg:rect x="5"
y="7" width="25" height="25"/>
						</svg:g>
					</svg:svg>
				</fo:instream-foreign-object>
			</fo:block>
However, as soon as I try 
             <fo:block>            
                 <fo:external-graphic src="url('graphics/svggen')"/>
             </fo:block>
The following error occurs:
		[ERROR] Error while creating area : Error with image URL:
graphics\svggen (The system cannot
		 find the path specified) and no base URL is specified
Is there a way to specify base URL, given that I am running within a Cocoon
pipeline?
Then if I try:
             <fo:block>            
                 <fo:external-graphic
src="url('http://localhost:8080/application/graphics/svggen')"/>
             </fo:block>

The error below appears.
Thanks a million if you have any suggestions to get help me get the SVG
properly referenced.
Cheers,
Anthony

Error: 
[INFO] [5]
		java.lang.NoSuchMethodError
		        at
org.apache.fop.image.analyser.SVGReader.loadImage(SVGReader.java:76)
		        at
org.apache.fop.image.analyser.SVGReader.verifySignature(SVGReader.java:60)
		        at
org.apache.fop.image.analyser.ImageReaderFactory.Make(ImageReaderFactory.jav
a:86)
		        at
org.apache.fop.image.FopImageFactory.Make(FopImageFactory.java:137)
		        at
org.apache.fop.fo.flow.ExternalGraphic.layout(ExternalGraphic.java:135)
		        at
org.apache.fop.fo.flow.Block.layout(Block.java:206)
		        at
org.apache.fop.fo.flow.AbstractFlow.layout(AbstractFlow.java:111)
		        at
org.apache.fop.fo.flow.AbstractFlow.layout(AbstractFlow.java:68)
		        at
org.apache.fop.fo.pagination.PageSequence.makePage(PageSequence.java:352)
		        at
org.apache.fop.fo.pagination.PageSequence.format(PageSequence.java:290)
		        at
org.apache.fop.apps.StreamRenderer.render(StreamRenderer.java:218)
		        at
org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)
		        at
org.apache.cocoon.xml.AbstractXMLPipe.endElement(AbstractXMLPipe.java:147)
		        at
org.apache.xalan.transformer.ResultTreeHandler.endElement(ResultTreeHandler.
java:307)
		        at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:
716)
		        at
org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApp
lyTemplates.j
		ava:422)
		        at
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.jav
a:226)
		        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform
erImpl.java:2
		243)
		        at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Transformer
Impl.java:206
		9)
		        at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.j
ava:1171)
		        at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3196)
		        at java.lang.Thread.run(Thread.java:479)



This message may contain privileged and/or confidential information.  If you
have received this e-mail in error or are not the intended recipient, you
may not use, copy, disseminate or distribute it; do not open any
attachments, delete it immediately from your system and notify the sender
promptly by e-mail that you have done so.  Thank you.
Received on Wednesday, 9 April 2003 17:02:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:10 GMT