W3C home > Mailing lists > Public > www-svg@w3.org > August 2000

Re: XML to SVG... more info (A working version)

From: <AndrewWatt2001@aol.com>
Date: Thu, 24 Aug 2000 13:40:14 EDT
Message-ID: <a9.a3a4343.26d6b7fe@aol.com>
To: www-svg@w3.org
CC: Libo.Torres@primark.com, RBoyet@aol.com
Hi again Rick & Libo,

I have taken Libo's code which he posted earlier and made some 
corrections/changes. It now works for me - it produces the text "Paco" in red 
at the top left of the browser window with a black rectangle below and to the 

I will post the XML file, XSLT transformation sheet and the output SVG file 
(from Instant Saxon). I guess you will be able to spot the changes and see if 
this code, which works for me, also works for you.

The XML file is:

<?xml version="1.0" ?>
    <?xml-stylesheet href="convertsvg1.xsl" type="text/xsl"?>

The XSLT file is:

<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

<xsl:output indent="yes" media-type="svg-xml" />
  <xsl:strip-space elements="*"/>

<!-- Add DOCTYPE -->
<xsl:template match="/">
    <xsl:text disable-output-escaping="yes">&lt;!DOCTYPE svg PUBLIC
"-//W3C//DTD SVG 20000802//EN" 

<xsl:template match="Name">
    <svg width="500" height="500">
        <text x="0.5cm" y="0.5cm" style="font-family:Verdana;
font-size:16pt; fill:red">       
            <xsl:value-of select='.'/>   
        <rect x="2cm" y="1cm" width="6cm" height="3cm"/>


The SVG file which Instant Saxon output was:

<?xml version="1.0" encoding="utf-8" ?><svg width="500" height="500"><text 
x="0.5cm" y="0.5cm" style="font-family:Verdana; font-size:16pt; fill:red">"Pac
o"</text><rect x="2cm" y="1cm" width="6cm" height="3cm"/></svg>

That SVG file displayed in IE5.5 as described above.

I hope that helps you both to get it working on your own systems.

Andrew Watt
Received on Thursday, 24 August 2000 13:40:49 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:46:49 UTC