cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jerm <>
Subject Making SVG
Date Wed, 24 May 2000 10:27:38 GMT
Hi All,

I am having a problem making SVG from XSL processing of XML.

SVG commonly uses Entities to apply reusable styles, for instance, exporting SVG from Illustrator
you get all your styles as entities.

	<?xml version="1.0" encoding="iso-8859-1"?>
	<!-- Generator: Adobe Illustrator 8.0.1, SVG Export Plug-In 1.0x73 -->
	<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN" ""
		<!ENTITY st0 "fill:#000000;stroke:none;">
		<!ENTITY st1 "font-family:'TrebuchetMS-Bold';">
		<!ENTITY st2 "stroke:#000000;">


	<svg xml:space="preserve" width="300.47" height="91.2">
		<path style="&st0;" d=" .... "/>

The Path object uses the entity &st0; to pick up it's style, when rendered on the client

The problem I have is this, how do I create an SVG, using XSL?

The Entity declarations and tags need to be present in the output, not expanded by the XSL.

I found I can do this: (sorry about the wrapping)

	<?xml version="1.0"?>
	<xsl:stylesheet version="1.0" xmlns:xsl="">
		<xsl:template match="page">
			<xsl:processing-instruction name="cocoon-format">type="image/svg"</xsl:processing-instruction>
			<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE svg PUBLIC "-//W3C//DTD
SVG 20000303 Stylable//EN" "" [
				<!ENTITY st0 "fill-rule:nonzero;fill:#0086B3;stroke:#000000;stroke-width:2.8346;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;">
				<!ENTITY st1 "font-size:12;font-family:TrebuchetMS-Bold;fill-rule:nonzero;">]>]]></xsl:text>
			<svg xml:space="preserve" width="300.47" height="91.2">
ie. put the DOCTYPE and Entities in a CDATA text node, but how do I then put in the entity
tag, without XSL wanting to expand it on the server?


<text x="42.24" y="82.7" style="&st1;">
	<xsl:value-of select="content/paragraph"/>

Any suggestions welcome

regards Jeremy


   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <>     		 <>
    <phone:+44.[0].20.7737.6831>        <>

View raw message