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