I'm applying a transform to SVG documents, to make them validate against the SVG RNG schema. I have everything working EXCEPT the name spaces on the SVG element itself. These SVG documents where edited in Adobe Illistrator, and the original SVG element is:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" xmlns:graph="http://ns.adobe.com/Graphs/1.0/" xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/" xmlns:x="http://ns.adobe.com/Extensibility/1.0/" xmlns:xlink="http://www.w3.org/1999/xlink">
and what I want is:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
The stylesheet starts:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/"
xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
xmlns:graph="http://ns.adobe.com/Graphs/1.0/"
xmlns:x="http://ns.adobe.com/Extensibility/1.0/"
exclude-result-prefixes="xs xd a x graph"
xpath-default-namespace="http://www.w3.org/2000/svg"
version="2.0">
My understanding is that 'exclude-result-prefixes="xs xd a x graph"' should not copy over the namespaces identified, but a, x, and graph are still there in the output. My main template is below, and it keeps the namespace & extensions off of the child elements of SVG, just not the SVG node itself.
<xsl:template match="@*|node()">
<xsl:choose>
<xsl:when test=". = //i:pgf"/> <!-- This is the BLOB -->
<xsl:when test=". = //@i:*" /> <!-- These three are all of the Adobe extensions -->
<xsl:when test=". = //metadata"/>
<xsl:when test=". = //foreignObject"/>
<xsl:when test=". = //switch"> <!-- We do not want the switch elements, just their text nodes. -->
<xsl:apply-templates select="node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Any ideas?