Code

try to preserve layers, strip top-level switch and foreignObject
authorbuliabyak <buliabyak@users.sourceforge.net>
Fri, 1 Feb 2008 09:39:36 +0000 (09:39 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Fri, 1 Feb 2008 09:39:36 +0000 (09:39 +0000)
share/extensions/aisvg.xslt

index e2e7096ff969e5d8058c9364e6da8f7dc00fc980..62a10ee935fadcf05a2d3468ad660c97651cf140 100644 (file)
@@ -7,11 +7,22 @@ xmlns:xlink="http://www.w3.org/1999/xlink"
 xmlns:x="http://ns.adobe.com/Extensibility/1.0/" \r
 xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/" \r
 xmlns:graph="http://ns.adobe.com/Graphs/1.0/" \r
-xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" >\r
+xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" \r
+xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\r
+>\r
 <xsl:output indent="yes"/>\r
        <xsl:template match="/">\r
                        <xsl:apply-templates />\r
        </xsl:template>\r
+  <xsl:template match="svg:svg/svg:switch[count(*)=2][name(*[1])='foreignObject']">\r
+               <xsl:apply-templates select="*[not(name()='foreignObject')]/*"/>\r
+  </xsl:template>\r
+       <xsl:template match="svg:svg/svg:g | svg:g[@i:extraneous='self']/svg:g">\r
+               <xsl:copy>\r
+      <xsl:attribute name="inkscape:groupmode">layer</xsl:attribute>\r
+                       <xsl:apply-templates select="@*|*"/>\r
+    </xsl:copy>\r
+  </xsl:template>\r
        <xsl:template match="*">\r
                <xsl:copy>\r
                <xsl:apply-templates select="@*|node()|text"/>\r