xml - export multiple (nested) layers of inkscape svg via xslt -
i want export multiple layrs inkscape svg.
the structure this: like:
- background
- layera
- layer1
- layer2
- layerb
- layer3
- layer4
- layera
and there more (sub) groups, because imported other svg objects had svg:g nodes.
i want export 1 png background , layera (including sublayers) , 1 png background , layer3 (including sublayers) .
i tried way described here: http://daniel-albuschat.blogspot.de/2013/03/export-layers-from-svg-files-to-png.html (second example)
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:svg="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" > <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="svg:g"/> <xsl:template match="svg:g[@inkscape:label='background']|svg:g[@inkscape:label='layera']|svg:g[@inkscape:label='layer3']"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
but objects directly under selected layers. inside svg:g not copied. want everything under selected layer copied.
how can that?
thank help
------edit-----
i think came little closer goal.
instead of:
<xsl:template match="svg:g[@inkscape:label='background']|svg:g[@inkscape:label='layera']|svg:g[@inkscape:label='layer3']"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template>
i use this:
<xsl:template match="svg:g[@inkscape:label='background']|svg:g[@inkscape:label='layera']|svg:g[@inkscape:label='layer3']"> <xsl:copy-of select="@*|node()"/> </xsl:template>
now subcildren copied wished. group element missing.
------edit2------ using:
<xsl:copy-of select="."/>
only not match groups in sub-children level.
i think need (notice "//"):
<xsl:template match="//svg:g[@inkscape:label='layer3']"> <xsl:copy-of select="."/> </xsl:template>
but not match on layer3. :(