Prevent xmlns=" " added to copy element using xslt



I have a XML file where i want to copy some element using XSLT, But it's adding xmlns=" " in copied element.


XSLT



<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://ift.tt/tCZ8VR" xmlns:x="http://ift.tt/1kQOu7M"
exclude-result-prefixes="x">
<xsl:output method="xml" indent="yes"/>
<!-- Identity transform -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="x:Adapter[@Key='AuditLogging']">
<xsl:copy-of select="."/>
<Adapter Key="AutoExport">
</Adapter>
</xsl:template>


XML



<Adapters xmlns="http://ift.tt/1kQOu7M">
<Adapter Key="LASTCHANGEDATE" />
<Adapter Key="AuditLogging" />
</Adapters>


Output XML



<Adapters xmlns="http://ift.tt/1kQOu7M">
<Adapter Key="LASTCHANGEDATE" />
<Adapter Key="AuditLogging" />
<Adapter Key="AutoExport" xmlns="" />
</Adapters>


How to prevent adding xmlns=" " in element.


No comments:

Post a Comment