MOVETO support

This commit is contained in:
Mylloon 2024-05-06 14:56:05 +02:00
parent d5aa66fc35
commit f7c4fb518f
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

22
svg.xsl
View file

@ -65,19 +65,29 @@
<xsl:param name="path" />
<xsl:choose>
<xsl:when test="$idx > count(LINETO)">
<xsl:when test="$idx > count(*)">
<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:variable
name="currentNode" select="*[position() = $idx]" />
<xsl:variable
name="pos" select="concat($currentNode/@x, ' ', $currentNode/@y)" />
<xsl:choose>
<xsl:when test="name($currentNode) = 'MOVETO'">
<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:with-param name="path" select="concat($path, ' M ', $pos)" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="generatePath">
<xsl:with-param name="idx" select="$idx + 1" />
<xsl:with-param name="path" select="concat($path, ' L ', $pos)" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>