2024-05-04 02:42:50 +02:00
|
|
|
<?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">
|
2024-05-05 20:40:36 +02:00
|
|
|
<!-- TODO: usage temporaire d'un offset pour que l'image soit pas hors de
|
|
|
|
l'écran, il faut trouver à l'avenir un moyen que ça soit automatique ?? -->
|
|
|
|
<xsl:variable name="offset" select="500" />
|
2024-05-04 02:42:50 +02:00
|
|
|
<xsl:variable name="path">
|
|
|
|
<xsl:call-template name="generatePath">
|
|
|
|
<xsl:with-param name="idx" select="1" />
|
2024-05-05 20:40:36 +02:00
|
|
|
<xsl:with-param name="path" select="'M ' || $offset || ' ' || $offset" />
|
|
|
|
<xsl:with-param name="offset" select="500" />
|
2024-05-04 02:42:50 +02:00
|
|
|
</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" />
|
2024-05-05 20:40:36 +02:00
|
|
|
<xsl:param name="offset" />
|
2024-05-04 02:42:50 +02:00
|
|
|
|
|
|
|
<xsl:choose>
|
|
|
|
<xsl:when test="$idx > count(LINETO)">
|
|
|
|
<xsl:value-of select="$path" />
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:variable name="x"
|
2024-05-05 20:40:36 +02:00
|
|
|
select="LINETO[$idx]/@x + number($offset)" />
|
2024-05-04 02:42:50 +02:00
|
|
|
<xsl:variable name="y"
|
2024-05-05 20:40:36 +02:00
|
|
|
select="LINETO[$idx]/@y + number($offset)" />
|
2024-05-04 02:42:50 +02:00
|
|
|
|
|
|
|
<xsl:call-template name="generatePath">
|
|
|
|
<xsl:with-param name="idx" select="$idx + 1" />
|
|
|
|
<xsl:with-param name="path" select="concat($path, ' L ', $x, ' ', $y)" />
|
2024-05-05 20:40:36 +02:00
|
|
|
<xsl:with-param name="offset" select="$offset" />
|
2024-05-04 02:42:50 +02:00
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
</xsl:transform>
|