You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jerm <je...@media.demon.co.uk> on 2000/05/23 19:41:35 UTC

Outputting Entities from XSL

I am experimenting with producing SVG using XSL from XML.
I want to send SVG straight to the browser.

How do you get XSL to output Entities?

I am trying to do something like this, where entities are used to apply style.


<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="page">
		<xsl:processing-instruction 
			name="cocoon-format">type="image/svg-xml"</xsl:processing-instruction>
		<!DOCTYPE svg PUBLIC 
			"-//W3C//DTD SVG 20000303 Stylable//EN"
			"http://www.w3.org/2000/svg10-20000303-stylable" [
			<!ENTITY st0 "fill:#000000;stroke:none;">
			[snip]
		]>
		<svg xml:space="preserve" width="300" height="90">
		<g id="Box">
			<path style="&st0;" d="M269.01,89.79H28.06V61.44h240.94v28.35z"/>
			<g>
				<text x="42.24" y="82.7" style="&st1; &st5; fill-rule:nonzero;">
					<xsl:value-of select="content/paragraph"/>
				</text>
			</g>
		</g>
		</svg>
	</xsl:template>
</xsl:stylesheet>


I get the following error:



        org.apache.cocoon.processor.ProcessorException: Could not associate stylesheet to document:  error reading /SharkBait/Applications/Development/Java/cocoon-1.7.4/samples/svg/page-svg.xsl: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.



If I leave out the DOCTYPE declaration, I get none in the output, and no Mime-Type is set.

What am I doing wrong?

Thanks

regards Jeremy
 

   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>



Re: Outputting Entities from XSL

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On 23/5/00 at 6:41 pm, jermq@media.demon.co.uk (Jerm) wrote:

>I am experimenting with producing SVG using XSL from XML.
>I want to send SVG straight to the browser.
>
>How do you get XSL to output Entities?

I still don't know how to do this ....

But the problem of getting client-side renderable SVG out of XSL is solved.

I think there is a bug in cocoon.properties 1.7.4.

Line: 
  formatter.type.image/svg-xml    = org.apache.cocoon.formatter.XMLFormatter
  
Should be: 
  formatter.type.image/svg    = org.apache.cocoon.formatter.XMLFormatter

Then this all gets applied properly:
  # SVG (20000303 WD)
  formatter.image/svg.doctype-public = -//W3C//DTD SVG 20000303 Stylable//EN
  formatter.image/svg.doctype-system = http://www.w3.org/TR/2000/03/WD-SVG-20000303/
  formatter.image/svg.MIME-type = image/svg-xml


When you have XSL like this:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:template match="page">
  <xsl:processing-instruction name="cocoon-format">type="image/svg"</xsl:processing-instruction>
  <svg xml:space="preserve" width="300" height="90">
   <g id="Box">
    <path 
style="fill-rule:nonzero;fill:#0086B3;stroke:#000000;stroke-width:2.8346;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;"
     d="M269.01,89.79H28.06V61.44h240.94v28.35z"/>
    <g>
     <text x="42.24" y="82.7" 
      style="font-size:12;font-family:TrebuchetMS-Bold;fill-rule:nonzero;">
      <xsl:value-of select="content/paragraph"/>
     </text>
    </g>
   </g>
  </svg>
 </xsl:template>
</xsl:stylesheet>

Excellent!

Now, how can I output Entities in my SVG?


Thanks

regards Jeremy

      ____________________________________________________________________

      Jeremy Quinn                                             media.demon
                                                           webSpace Design
     <ma...@media.demon.co.uk>       <http://www.media.demon.co.uk>
      <phone:+44.[0].20.7737.6831>          <pa...@sms.genie.co.uk>