49 lines
1.4 KiB
XML
49 lines
1.4 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
xmlns="http://www.w3.org/2000/svg">
|
|
<xsl:output indent="yes" />
|
|
|
|
<xsl:template match="/">
|
|
<svg version="1.0"
|
|
xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<xsl:apply-templates select="traceur" />
|
|
</svg>
|
|
</xsl:template>
|
|
|
|
<!-- Template pour le traceur -->
|
|
<xsl:template match="traceur">
|
|
<xsl:variable name="path">
|
|
<xsl:call-template name="generatePath">
|
|
<xsl:with-param name="idx" select="1" />
|
|
<xsl:with-param name="path" select="'M 0 0'" />
|
|
</xsl:call-template>
|
|
</xsl:variable>
|
|
|
|
<path
|
|
d="{$path}" stroke="green" fill="none" />
|
|
</xsl:template>
|
|
|
|
<!-- Fonction récursive terminale -->
|
|
<xsl:template name="generatePath">
|
|
<xsl:param name="idx" />
|
|
<xsl:param name="path" />
|
|
|
|
<xsl:choose>
|
|
<xsl:when test="$idx > count(LINETO)">
|
|
<xsl:value-of select="$path" />
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:variable name="x"
|
|
select="LINETO[$idx]/@x" />
|
|
<xsl:variable name="y"
|
|
select="LINETO[$idx]/@y" />
|
|
|
|
<xsl:call-template name="generatePath">
|
|
<xsl:with-param name="idx" select="$idx + 1" />
|
|
<xsl:with-param name="path" select="concat($path, ' L ', $x, ' ', $y)" />
|
|
</xsl:call-template>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:template>
|
|
|
|
</xsl:transform>
|