-
Notifications
You must be signed in to change notification settings - Fork 0
/
hatchscript-gen.xsl
31 lines (17 loc) · 1.01 KB
/
hatchscript-gen.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.0">
<xsl:output method="text"/>
<xsl:template match="@* | node()">
<xsl:apply-templates select="@* | node()"/>
</xsl:template>
<xsl:template match="svg:path[contains(@id, 'mypath')]">
<xsl:variable name="i" select="@id"/>
<xsl:variable name="j" select="substring($i, 7) mod 180"/>
xsltproc --stringparam hatchAngle <xsl:value-of select="$j"/> hatchscript-rotate.xsl ~/Library/Application\ Support/org.inkscape.Inkscape/config/inkscape/preferences.xml > /tmp/preferences.xml;
cp /tmp/preferences.xml ~/Library/Application\ Support/org.inkscape.Inksckape/config/inkscape/;
/Applications/Inkscape.app/Contents/MacOS/inkscape -g --select=<xsl:value-of select="@id"/> --verb "command.evilmadscientist.eggbot_hatch.noprefs; FileSave; FileQuit" /tmp/foo2.svg;
</xsl:template>
</xsl:stylesheet>