You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by BORGES Charles <ch...@cegetel.fr> on 2003/10/10 12:25:16 UTC
Problem using SVG serialializer after a transformation
Hi,
I run into the following problem when serializing to svg after a xsl
transformation:
Start with a sitemap including something like this
<map:match pattern="*.png">
<map:generate src="{1}.svg"/>
<map:transform src="xsl/{1}.xsl" type="xslt"/>
<map:serialize type="svg2png"/>
</map:match>
Turn the debug on and check for the SVGSerializer logging.
You see that serialization of the xsl transformation output produces the
massage:
"setDocumentLocator was not called, will use http://localhost/ as base URI".
This means that if i have a href in my svg to a css for instance, it won't
be located and the serialization will fail!
I fixed it (somehow) by:
1.introducing a base-url attribute in the SVGSerializer configuration:
<map:serializer logger="sitemap.serializer.svg2png"
name="svg2png"
src="fr.cegetel.dsco.gi.svg.serialization.SVGSerializer"
mime-type="image/png"
base-url="context://sample/batik"/>
3.using the sourceresolver to find out the uri to set in the document
locator.
2.making the SVGBuilder no more Recyclable.
Charles
Re: Problem using SVG serialializer after a transformation
Posted by Sylvain Wallez <sy...@anyware-tech.com>.
BORGES Charles wrote:
>Hi,
>
>I run into the following problem when serializing to svg after a xsl
>transformation:
>
>Start with a sitemap including something like this
><map:match pattern="*.png">
> <map:generate src="{1}.svg"/>
> <map:transform src="xsl/{1}.xsl" type="xslt"/>
> <map:serialize type="svg2png"/>
></map:match>
>
>
>Turn the debug on and check for the SVGSerializer logging.
>You see that serialization of the xsl transformation output produces the
>massage:
>"setDocumentLocator was not called, will use http://localhost/ as base URI".
>
>This means that if i have a href in my svg to a css for instance, it won't
>be located and the serialization will fail!
>
>I fixed it (somehow) by:
>1.introducing a base-url attribute in the SVGSerializer configuration:
><map:serializer logger="sitemap.serializer.svg2png"
> name="svg2png"
> src="fr.cegetel.dsco.gi.svg.serialization.SVGSerializer"
> mime-type="image/png"
> base-url="context://sample/batik"/>
>
Be careful: the convention in configurations is that attributes are
container-related data. Component-related data should be better located
as child elements. So the following should be better:
<map:serializer ....>
<base-url>context://sample/batik</base-url>
</map:serializer>
>3.using the sourceresolver to find out the uri to set in the document locator.
>
So do you really need the base-url? Isn't the uri of
SourceResolver.resolveURI("") just what you need? Or at least it can be
a fallback if base-url is not present.
>2.making the SVGBuilder no more Recyclable.
>
Why can it no more be Recyclable?
Sylvain
--
Sylvain Wallez Anyware Technologies
http://www.apache.org/~sylvain http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance - http://www.orixo.com