Expected output:
<ns0:ASN xmlns:ns0="USA_Common_856_Outbound">
<SITE_CODE>RGU</SITE_CODE>
<Line Items xmlns:ns0="USA_Common_856_Outbound">
<item code>10141498</item code>
</Line Items>
</ns0:ASN>
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var"
exclude-result-prefixes="msxsl var s0 userCSharp" version="1.0"
xmlns:s0="http://schemas.royalcanin.com/BizTalk/2012"
xmlns:ns0="USA_Common_856_Outbound"
xmlns:userCSharp="http://schemas.microsoft.com/BizTalk/2003/userCSharp">
<xsl:output omit-xml-declaration="yes" indent="yes" method="xml" version="1.0" />
<xsl:template match="/*">
<xsl:element name="ns0:{local-name()}" namespace="{namespace-uri()}">
<xsl:apply-templates select="@*|node()" />
</xsl:element>
</xsl:template>
<ns0:ASN>
<SITE_CODE>
<xsl:text>RGU</xsl:text>
</SITE_CODE>
<Line Items xmlns:ns0="USA_Common_856_Outbound">
<item code>
<xsl:value of select="../../s0:No/text()" />
</item code>
</Line Items>
</ns0:ASN>
ns0 needs to be applied for both <ASN> and <Line Items>.
Either <Line Items> is empty without namespace else ns0 is missed. only for <ASN> ns0 is applied.
I tried many samples but it is not working.