RE: [xsl] SVG, no actual output

Subject: RE: [xsl] SVG, no actual output
From: Jarno.Elovirta@xxxxxxxxx
Date: Thu, 22 Aug 2002 08:18:29 +0300
Hi,

> I'm trying to get SVG output to the browser, but i'm getting
> only the svg code instead of picture. My browser is svg compatible.
>
> XSLT:
> 
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> 
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
>  "http://www.w3.org/TR/SVG/DTD/svg10.dtd"; [
>  <!ATTLIST svg
>   xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink";>
>  ]>
> 
> <!-- stylesheet.xsl -->
> <xsl:stylesheet version="1.0" 
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

... err... you have an doctype declaration for SVG in you XSLT stylesheet... err... why? If your XSLT processor validated the stylesheet, this would result in an error. 

>   <xsl:output method="xml" indent="yes"/>
> 
> <xsl:template match="/">
>  <svg>
> <g transform="translate(40,40)">
> <text font-size="20">This is a test.</text>
> <rect x="0" y="0" width="560" height="420" fill="none" stroke="black"
> stroke-dasharray="10 10"/>
> <text text-anchor="middle" x="280" y="210" 
> font-size="60">Screen</text>
> <rect x="0" y="-20" width="120" height="20" fill="none" 
> stroke="black"/>
> <line x1="-5" y1="-5" x2="5" y2="5" stroke="black"/>
> <line x1="-5" y1="5" x2="5" y2="-5" stroke="black"/>
> </g>
> </svg>
> </xsl:template>
> </xsl:stylesheet>
> 
> 
> And the result is:
> <?xml version="1.0" encoding="UTF-8"?>
> <svg xmlns="http://www.w3.org/2000/svg";
> xmlns:xlink="http://www.w3.org/1999/xlink"; 
> preserveAspectRatio="xMidYMid meet"
> zoomAndPan="magnify" contentStyleType="text/css"
> contentScriptType="text/ecmascript" version="1.0">
> <g transform="translate(40,40)">
> <text font-size="20">This is a test.</text>
> <rect x="0" y="0" width="560" height="420" fill="none" stroke="black"
> stroke-dasharray="10 10"/>
> <text text-anchor="middle" x="280" y="210" 
> font-size="60">Screen</text>
> <rect x="0" y="-20" width="120" height="20" fill="none" 
> stroke="black"/>
> <line x1="-5" y1="-5" x2="5" y2="5" stroke="black"/>
> <line x1="-5" y1="5" x2="5" y2="-5" stroke="black"/>
> </g>
> </svg>
> 
> 
> What the heck am I doing wrong???????

What's the mime-type of the document when you're returning it (from the server?)? text/plain?

Cheers,

Jarno

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread