You must generate <rect> in the svg namespace.
Try:
<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="//[EMAIL PROTECTED]'myRect']">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<svg:rect x="100" y="100" width="165" height="126"
fill="blue"/>
</xsl:copy>
</xsl:template>
En/na Lincoln Mitchell ha escrit:
What kind of transform are you running?
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="//[EMAIL PROTECTED]'myRect']">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<rect x="100" y="100" width="165" height="126"
fill="blue"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Here is the original svg (as The one I sent before did not have '<g
id="myRect">'):
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG Version:
6.00 Build 51448) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg version="1.1" id="square" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;"
width="165" height="126" viewBox="0 0 165 126"
style="overflow:visible;enable-background:new 0 0 165 126;"
xml:space="preserve">
<g id="myRect">
<rect width="165" height="126" fill="pink"/>
</g>
</svg>
--
Josep A. Frau
Centre de Tecnologies de la Informació
Universitat de les Illes Balears
|
- Re: SVG > SVG via xslt Josep A. Frau
-