Just found the solution by adding a xmlns=""
to the <xsl:stylesheet
. Seems like WSO2 gives a default namespace when none is specified.
<xsl:stylesheet xmlns="" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:avintis="http://www.avintis.com/esb" extension-element-prefixes="avintis" version="2.0" exclude-result-prefixes="#all" xpath-default-namespace="">
<xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/soapenv:Envelope|soapenv:Body">
<xsl:copy>
<xsl:apply-templates select="*|text()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="root">
<xsl:copy>
<!-- FIRST METHOD - THE METHOD I want to use! this will receive the xmlns="http://ws.apache.org/ns/synapse" -->
<NEW>
<xsl:value-of select="MyElement"/>
</NEW>
<!-- Second methodworks - but I need to add xmlns="" to every element and there are a lot-->
<NEW xmlns="">
<xsl:value-of select="MyElement"/>
</NEW>
<!-- Third method works: But not very readable - I would prefer the first method -->
<xsl:element name="NEW">
<xsl:value-of select="MyElement"/>
</xsl:element>
</xsl:copy>
</xsl:template>