Hi All,
Please provide me XSLT code for adding namespace.
Input xml:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Documentxmlns:ns0="http://abcd.com">
<ns0:CstmrCdtTrfInitn>
Output xml:
<Documentxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">
<CstmrCdtTrfInitn>
____________________________________________________________________________
I treid below code but no success.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|text()|comment()|processing-instruction()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Document">
<Request xmlns="http://abcd.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsl:apply-templates select="@*|node()"/>
</Request>
</xsl:template>
<xsl:template match="*">
<xsl:element name="{local-name()}" namespace="http://abcd.com">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks & Regards,
Nida