- From: Dean Jackson <dean@w3.org>
- Date: Fri, 25 Oct 2002 22:04:41 +1000
- To: AndrewWatt2001@aol.com
- Cc: www-svg@w3.org
On Fri, 25 Oct 2002, AndrewWatt2001@aol.com wrote:
>
> The XSLT stylesheet shown in 6.6 does not produce the output shown, at least
> it doesn't using Instant Saxon 6.5.2.
Correct. Here is (one example of) a fixed version. Tested with xsltproc.
<?xml version="1.0" standalone="no"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:svg="http://www.w3.org/2000/svg">
<xsl:output method="xml"
encoding="utf-8"
doctype-public="-//W3C//DTD SVG 1.1//EN"
doctype-system="http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"/>
<!-- Add version to topmost 'svg' element -->
<xsl:template match="/svg:svg">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:attribute name="version">1.1</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<!-- Add styling to all 'rect' elements -->
<xsl:template match="svg:rect">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:attribute name="fill">red</xsl:attribute>
<xsl:attribute name="stroke">blue</xsl:attribute>
<xsl:attribute name="stroke-width">3</xsl:attribute>
</xsl:copy>
</xsl:template>
<!-- default is to copy input element -->
<xsl:template match="*|@*|text()">
<xsl:copy>
<xsl:apply-templates select="*|@*|text()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Received on Friday, 25 October 2002 08:04:54 UTC