Export by ID plus xpath
by Pawel Cesar Sanjuan Szklarz
Hi.
>From console it is possible to export selected elements by ID. It is
great, but i don't like to remember all the ID and write/maintain a
bash script for my projects.
I prepare a work around:
1) prepare a layer with all export areas
2) generate by xslt a bash script that export all object in my selected layer.
Here is the xslt template:
<?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">
<xsl:output method="text" indent="yes" encoding="utf-8" />
<xsl:variable name="toExport" select="//svg:g[@id='toExport']/svg:rect" />
<xsl:variable name="filename" select="'project.svg'" />
<xsl:template match="/">
<xsl:text>#!/bin/bash</xsl:text>
<xsl:for-each select="$toExport">
<xsl:call-template name="inkscapeExport"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="inkscapeExport">
<xsl:text>
</xsl:text>
<xsl:text>inkscape -z </xsl:text>
<xsl:text> -i </xsl:text><xsl:value-of select="@id"/>
<xsl:text> -e export/</xsl:text><xsl:value-of
select="@id"/><xsl:text>.png</xsl:text>
<xsl:text> -f </xsl:text><xsl:value-of select="$filename"/>
</xsl:template>
</xsl:stylesheet>
It is possible to add something like this to the console options??
export by xpath???
It can work in this way:
inkscape -X '//svg:g[@id='toExport']/svg:rect'
"export all the object that fit the xpath //svg:g[@id='toExport']/svg:rect"
Pawel Szklarz