Reputation: 43
I have to remove the soap name space associated with ConfigR(attribute).
Inside XSLT I am using XSL Copy and hence exclude prefix is not working.
I have tried below, but not working.Please can anyone suggest.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
<xsl:output indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="soapenv:*">
<xsl:apply-templates select="@* | node()"/>
</xsl:template>
</xsl:stylesheet>
Input -
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ConfigR>
Inside I have some more input.
</ConfigR>
</soapenv:Body>
</soapenv:Envelope>
Now in Output I am getting:
<ConfigR xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
Upvotes: 0
Views: 64
Reputation: 1695
You can replace you existing template:
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
with following:
<xsl:template match="*">
<xsl:element name="{local-name(.)}">
<xsl:apply-templates select="@* | node()" />
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute name="{local-name(.)}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:template>
You can find it here
Upvotes: 1