Dear all,
I have an xml file with a namespace "http://com.mytest/old_name_space". I want to use xslt to copy this xml file without changing any thing except I want to replace the name space with the new one "http://com.mytest/old_name_space".
I modified some codes I took from an article but I failed.
Could you provide a help?
Regards.
Pengyou
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:from="http://com.mytest/old_name_space" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
<xsl:output method="xml" encoding="iso-8859-1" indent="yes"/>
<xsl:template match="from:*">
<xsl:element name="{name(.)}" namespace="http://com.mytest/new_name_space">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
<!-- copy values -->
<xsl:template match="@*">
<xsl:choose>
<xsl:when test="local-name(.) ='schemaLocation'">
</xsl:when>
<xsl:otherwise>
<xsl:copy/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>