You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <DH...@csir.co.za> on 2002/05/20 15:49:53 UTC

Problems with SVG

I am struggling to get Cocoon to generate even a simple SVG image
encoded as a .png file inside an HTML page.

I am working with a subsite in Cocon 2.0.

Here is the subsitemap entry:
<map:match pattern="test-graph">
  <map:generate src="docs/testgraph.xml"/>
  <map:transform src="styles/svg-graph-test.xsl"/>
  <map:transform type="extractor"/>
  <map:transform src="styles/fragment-extractor.xsl"/>
  <map:serialize/>
</map:match>    

<map:match pattern="svg-images/*.png">
  <map:generate type="extractor" src="{1}"/>
  <map:serialize type="svg2png"/>
</map:match>

<!-- there are obviously also all the necessary entries
     in the map:serializer portion; as per the sample map
-->


A testgraph.xml file thus:
<?xml version="1.0" encoding="UTF-8"?>
<graph>
  <circle/>
</graph>


with a svg-graph-test.xsl stylesheet thus:
<?xml version="1.0"?>
<xsl:stylesheet 
  version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:xlink="http://www.w3.org/1999/xlink"
	xmlns:svg="http://www.w3.org/2000/svg">

<xsl:template match="/">
<html>
  <head>
    <title>SVG Test</title>
  </head>
  <body bgcolor="#ffffff">
  <p align="center">Test inclusion of SVG into web page as HTML...</p>

  <p align="center">

   <svg:svg width="300" height="300">
    <circle style="fill:blue;stroke:red;" cx="200" cy="200" r="100"/>
  </svg:svg>  
 
  </p>
  </body>
</html>
</xsl:template>


and a fragment (fragment-extractor.xsl) processor thus:
<?xml version="1.0"?>
<xsl:stylesheet 
  version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fe="http://apache.org/cocoon/fragmentextractor/2.0">
	
  <xsl:template match="//fe:fragment">
    <img src="svg-images/{@fragment-id}.png" border="0"/>
  </xsl:template>
	
 <xsl:template match="@*|*|text()|processing-instruction()"
priority="-1">
   <xsl:copy>
      <xsl:apply-templates
select="@*|*|text()|processing-instruction()"/>
   </xsl:copy>
 </xsl:template>

</xsl:stylesheet>


gives the following error in the log:

ERROR   (2002-05-20) 15:34.32:867   [cocoon  ]
(/cocoon/indicators/svg-images/4c9d70-edee15fcbf--8000.png)
HttpProcessor[8080][4]/SVGSerializer: SVGSerializer: Exception writing
image
org.apache.batik.transcoder.TranscoderException: null
Enclosed Exception: null


Any help as to what is causing this would be appreciated
Derek


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>