Last active
September 1, 2019 18:52
-
-
Save slmcmahon/71f323556e1c9f306292c3e537cf3315 to your computer and use it in GitHub Desktop.
Remove NameSpaces and SOAP Envelope
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet | |
version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" | |
exclude-result-prefixes="soapenv"> | |
<xsl:strip-space elements="*"/> | |
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> | |
<!-- remove all elements in the soapenv namespace --> | |
<xsl:template match="soapenv:*"> | |
<xsl:apply-templates select="node()"/> | |
</xsl:template> | |
<!-- for the remaining elements (i.e. elements in the default namespace) ... --> | |
<xsl:template match="*"> | |
<!-- ... create a new element with similar name in no-namespace --> | |
<xsl:element name="{local-name()}"> | |
<xsl:apply-templates select="@*|node()"/> | |
</xsl:element> | |
</xsl:template> | |
<!-- convert attributes to elements --> | |
<xsl:template match="@*"> | |
<xsl:element name="{local-name()}"> | |
<xsl:value-of select="." /> | |
</xsl:element> | |
</xsl:template> | |
</xsl:stylesheet> | |
<!-- Original Source: https://stackoverflow.com/a/26373021 --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment