W3C home > Mailing lists > Public > www-svg@w3.org > June 2002

Re: [Fwd: Merging SVG and XML with XSL Transformation?]

From: Darya Said-Akbari <darya_akbari@yahoo.com>
Date: Tue, 18 Jun 2002 12:41:34 +0200 (CEST)
Message-ID: <20020618104134.21006.qmail@web20502.mail.yahoo.com>
To: Max Froumentin <mf@w3.org>, batik-users@xml.apache.org, www-svg@w3.org
Cc: Vincent Hardy <vincent.hardy@sun.com>

Dear Max,

that is exactly what I want.

But the transformation fails, when I try your solution
with the latest Xalan version xalan-j_2_3_1.

Below is the commandline I used:

java org.apache.xalan.xslt.Process 
-in  infile.svg
-xsl stylesheet.xsl
-out outfile.svg

Where the files look like:

infile.svg:

<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="500" height="500">
	<text x="51px" y="40px"
style="fill:rgb(255,0,0);font-size:12;font-family:Arial">anchorA</text>
</svg>


stylesheet.xsl:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- identity transform -->
<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>
<!-- template that picks up anchors in the SVG and get
the corresponding text from the xml file -->
<xsl:template match="text[.='anchorA']">
  <text><xsl:value-of
select="document('text.xml')/texts/txt[@id='anchorA']"/></text>
</xsl:template>
</xsl:stylesheet>


text.xml:

<?xml version="1.0" encoding="UTF-8"?>
<texts>
  <txt id="anchorA">Hello World!</txt>
</texts>


The result is outfile.svg:

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="500"
height="500" preserveAspectRatio="xMidYMid meet"
zoomAndPan="magnify" version="1.0"
contentScriptType="text/ecmascript"
contentStyleType="text/css">
	<text x="51px" y="40px"
style="fill:rgb(255,0,0);font-size:12;font-family:Arial">anchorA</text>
</svg>

You see, the result still shows "anchorA" and not
"Hello World".

I have no clue why the transformation doesn't do its
work. However I like to get your example run, since it
really hit my problem.

So, any further assistance from you I very welcome.

regards,
Darya 

__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Yahoo! präsentiert als offizieller Sponsor das Fußball-Highlight des
Jahres: - http://www.FIFAworldcup.com
Received on Tuesday, 18 June 2002 06:41:36 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:22 GMT