for offset: use translate
This commit is contained in:
parent
436c41a5d0
commit
cbd29f50a6
1 changed files with 12 additions and 11 deletions
19
svg.xsl
19
svg.xsl
|
@ -12,26 +12,28 @@
|
||||||
|
|
||||||
<!-- Template pour le traceur -->
|
<!-- Template pour le traceur -->
|
||||||
<xsl:template match="traceur">
|
<xsl:template match="traceur">
|
||||||
<!-- 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" />
|
|
||||||
<xsl:variable name="path">
|
<xsl:variable name="path">
|
||||||
<xsl:call-template name="generatePath">
|
<xsl:call-template name="generatePath">
|
||||||
<xsl:with-param name="idx" select="1" />
|
<xsl:with-param name="idx" select="1" />
|
||||||
<xsl:with-param name="path" select="'M ' || $offset || ' ' || $offset" />
|
<xsl:with-param name="path" select="'M 0 0 '" />
|
||||||
<xsl:with-param name="offset" select="$offset" />
|
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
|
<!-- 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="250" />
|
||||||
|
<g
|
||||||
|
transform="translate({$offset}, {$offset})">
|
||||||
<path
|
<path
|
||||||
d="{$path}" stroke="green" fill="none" />
|
d="{$path}" stroke="green" fill="none" />
|
||||||
|
</g>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<!-- Fonction récursive terminale -->
|
<!-- Fonction récursive terminale -->
|
||||||
<xsl:template name="generatePath">
|
<xsl:template name="generatePath">
|
||||||
<xsl:param name="idx" />
|
<xsl:param name="idx" />
|
||||||
<xsl:param name="path" />
|
<xsl:param name="path" />
|
||||||
<xsl:param name="offset" />
|
|
||||||
|
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$idx > count(LINETO)">
|
<xsl:when test="$idx > count(LINETO)">
|
||||||
|
@ -39,14 +41,13 @@
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:variable name="x"
|
<xsl:variable name="x"
|
||||||
select="LINETO[$idx]/@x + number($offset)" />
|
select="LINETO[$idx]/@x" />
|
||||||
<xsl:variable name="y"
|
<xsl:variable name="y"
|
||||||
select="LINETO[$idx]/@y + number($offset)" />
|
select="LINETO[$idx]/@y" />
|
||||||
|
|
||||||
<xsl:call-template name="generatePath">
|
<xsl:call-template name="generatePath">
|
||||||
<xsl:with-param name="idx" select="$idx + 1" />
|
<xsl:with-param name="idx" select="$idx + 1" />
|
||||||
<xsl:with-param name="path" select="concat($path, ' L ', $x, ' ', $y)" />
|
<xsl:with-param name="path" select="concat($path, ' L ', $x, ' ', $y)" />
|
||||||
<xsl:with-param name="offset" select="$offset" />
|
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
|
|
Reference in a new issue