Saxon: namespace-alias removes the required xmlns attribute
Posted: Fri Oct 17, 2008 12:04 pm
I have the problem to create SVG output with XSLT Saxon8 that should look like following snippet, but I cannot get the xmlns attribute into the output!
With the following INCLUDED in the XSLT the attribute xmlns="http://www.w3.org/2000/svg" is removed from the result at any spot and cannot be included (not using exclude-result-prefixes for svg).
With exactly this line REMOVED in the XSLT the result looks like that and gives errors in Xerces (Element type "svg:svg" must be declared):
Any hints are appreciated!
Thanks for any help & hints!
I am using Oxygen 8.2, but upgraded the saxon jars to the latest.
----
Code: Select all
<!DOCTYPE svg
PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="1280" xmlns="http://www.w3.org/2000/svg" version="1.1">
Code: Select all
<xsl:namespace-alias stylesheet-prefix="svg" result-prefix="#default"/>
Code: Select all
<!DOCTYPE svg:svg
PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg:svg xmlns:svg="http://www.w3.org/2000/svg" width="100%" height="1280" version="1.1">
<svg:g transform="translate(0,0)">
Thanks for any help & hints!
I am using Oxygen 8.2, but upgraded the saxon jars to the latest.
----
Code: Select all
<xsl:stylesheet version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:svg="http://www.w3.org/2000/svg"
exclude-result-prefixes="fn xs">
<xsl:output
method="xml"
doctype-public="-//W3C//DTD SVG 1.0//EN"
doctype-system="http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"
media-type="image/svg+xml"
version="1.0"
xmlns="http://www.w3.org/2000/svg"
indent="yes"/>
<!--<xsl:namespace-alias stylesheet-prefix="svg" result-prefix="#default"/>-->
<xsl:template match="/">
<svg:svg width="100%" height="100%" version="1.1">
<xsl:apply-templates select="...."/>
</svg:svg>
</xsl:template>