RE: [xsl] XSL SVG?

Subject: RE: [xsl] XSL SVG?
From: "Max Dunn" <maxdunn@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 10 Mar 2002 13:37:24 -0800
Hi Richard,

I don't think inline SVG is so well implemented: also, you forgot the
namespace prefix on <line>. With IE and the Adobe SVG viewer, you can do
the following:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 xmlns:svg="http://www.w3.org/2000/svg";>
<xsl:template match="/">
<html>
<head>
<object id="AdobeSVG"
   classid="clsid:78156a80-c6a1-4bbf-8e6a-3cd390eeb4e2">
</object>
<xsl:processing-instruction name="import">
	<xsl:text>namespace="svg" implementation="#AdobeSVG"</xsl:text>
</xsl:processing-instruction>
</head>
<body>
<svg:svg width="300" height="300">
 <svg:line x1="127" y1="65" x2="127" y2="200" 
	style="stroke:rgb(0,0,0);stroke-width:2"/>
</svg:svg>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

But that will only work in IE with recent versions of the Adobe SVG
Viewer. It would certainly be nice if SVG were implemented in browsers
as just another namespace: there is a build of the Mozilla project that
does this, http://www.mozilla.org/projects/svg/ with examples/info at
http://www.croczilla.com/svg/

The transformation for that SVG implementation in Mozilla would be
something like:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 xmlns="http://www.w3.org/1999/xhtml";
 xmlns:svg="http://www.w3.org/2000/svg";>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<html>
<head>
</head>
<body>
<svg:svg width="300" height="300">
 <svg:line x1="127" y1="65" x2="127" y2="200" 
 style="stroke:#000000; stroke-width:2;"/>
</svg:svg>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

More like what you were thinking of... 

You could also have two XSLT stylesheets (for HTML and SVG) and two ASP
files that run the transformations against a single XML source, i.e. in
the HTML output from the first ASP:
<embed src="svg.asp" width="width" height="height" type="image/svg+xml"
/> 
where svg.asp generates the SVG (with
Response.ContentType="image/svg+xml").


HTH,

Max


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Richard
Hallgren
Sent: Sunday, March 10, 2002 6:09 AM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] XSL SVG?


Hi everyone,

I'm trying to generate a simple SVG shape from a XSL page, 
if I a embed the external SVG picture it works fine but 
when I try to generate the shape from the xsl file I just 
can't get it to work... How can I solve this? The final 
output is HTML generated through ASP, here is the relevant 
code from the XSL file:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
 xmlns:svg="http://www.w3.org/2000/svg";> 
<xsl:template match="/">
<HTML>
<HEAD/>
<BODY>
<svg:svg width="300" height="300">
 <line x1="127" y1="65" x2="127" y2="200" style="stroke:rgb
(0,0,0);stroke-width:2"/>
</svg:svg>
...

Thanks in advance,
Richard 
---------------------------
Richard Hallgren
richard.hallgren@xxxxxxx
+44 (0) 2890915132
+44 (0) 7816326858


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


Current Thread