Hi again,
I have one more question to inquiry from you guys that if I want to want to use XSLT copying from xml containing namespace to a new xml without namespace. How can I do it. I have written XSLT for this routine, but it still did not work as what I want yet, so can anyone give me some suggestion to work through it. Thank you in advance.
Source XML file.
<?xml version="1.0"?>
<order xmlns="http://test.com/OrderAdd" name="OrderAdd">
<orderheader>
<name>Jame</name>
<surname>Cool</surname>
<product>
<id>001</id>
<name>book</name>
<qty>3</qty>
</product>
<shiptoaddress>
<name>John Good</name>
<name>IT company</name>
</shiptoaddress>
</orderheader>
</order>
Existing XSLT file.
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:t="http://test.com/OrderAdd">
<xsl:template match="t:order">
<gapi>
<xsl:apply-templates/>
</gapi>
</xsl:template>
<xsl:template match="t:*">
<orderheader>
<xsl:copy-of select="@*|node()" />
</orderheader>
</xsl:template>
</xsl:stylesheet>
Current result.
<?xml version="1.0" encoding="UTF-8"?>
<gapi xmlns:t="http://test.com/OrderAdd">
<orderheader>
<name xmlns="http://test.com/OrderAdd">Jame</name>
<surname xmlns="http://test.com/OrderAdd">Cool</surname>
<product xmlns="http://test.com/OrderAdd">
<id>001</id>
<name>book</name>
<qty>3</qty>
</product>
<shiptoaddress xmlns="http://test.com/OrderAdd">
<name>John Good</name>
<name>IT company</name>
</shiptoaddress>
</orderheader>
</gapi>
how to make to the following result?
<?xml version="1.0" encoding="UTF-8"?>
<gapi xmlns="http://test.com/OrderAdd">
<orderheader>
<name>Jame</name>
<surname>Cool</surname>
<product>
<id>001</id>
<name>book</name>
<qty>3</qty>
</product>
<shiptoaddress>
<name>John Good</name>
<name>IT company</name>
</shiptoaddress>
</orderheader>
</gapi>