I
insane79
Hi,
i have one problem with an xsl trasformation (I'm using Xalan)
The source XML document is the following:
<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<ROOT xmlns:NAME='old_namespace'>
<NAME:element>...</NAME:element>
<NAME:element>...</NAME:element>
</ROOT>
What i want is to change the uri of the namespace from
"old_namespace" to "new_namespace".
To achive this goal i've wrote this document:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet
version = "1.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
xmlns:NAME = "old_namespace">
<xsl:template match = "/">
<xsl:element name = "ROOT">
<xsl:attribute name = "xmlns:NAME">new_namespace</xsl:attribute>
<xsl:copy-of select="/ROOT/NAME:element" />
</xsl:element>
</xsl:template>
</xsl:styleshee>
And the result of the transformation is:
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:NAME="new_namespace">
<NAME:element xmlns:NAME="old_namespace">...</NAME:element>
<NAME:element xmlns:NAME="old_namespace">...</NAME:element>
</ROOT>
The namespace definition in the root element is changed
but the processor have put the old namespace definition
in every child of the root.
The result that i expected is
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:NAME="new_namespace">
<NAME:element>...</NAME:element>
<NAME:element>...</NAME:element>
</ROOT>
I hope that the explanation of the problem was clear.
Thanks
i have one problem with an xsl trasformation (I'm using Xalan)
The source XML document is the following:
<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<ROOT xmlns:NAME='old_namespace'>
<NAME:element>...</NAME:element>
<NAME:element>...</NAME:element>
</ROOT>
What i want is to change the uri of the namespace from
"old_namespace" to "new_namespace".
To achive this goal i've wrote this document:
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet
version = "1.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
xmlns:NAME = "old_namespace">
<xsl:template match = "/">
<xsl:element name = "ROOT">
<xsl:attribute name = "xmlns:NAME">new_namespace</xsl:attribute>
<xsl:copy-of select="/ROOT/NAME:element" />
</xsl:element>
</xsl:template>
</xsl:styleshee>
And the result of the transformation is:
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:NAME="new_namespace">
<NAME:element xmlns:NAME="old_namespace">...</NAME:element>
<NAME:element xmlns:NAME="old_namespace">...</NAME:element>
</ROOT>
The namespace definition in the root element is changed
but the processor have put the old namespace definition
in every child of the root.
The result that i expected is
<?xml version="1.0" encoding="UTF-8"?>
<ROOT xmlns:NAME="new_namespace">
<NAME:element>...</NAME:element>
<NAME:element>...</NAME:element>
</ROOT>
I hope that the explanation of the problem was clear.
Thanks