A common question often asked is "I have a namespace qualified XML document -
I need to remove all xmlns attributes from the same".
Here is an XSLT that you can use to strip all namespaces from your document.
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- exclude-result-prefixes="xsl">
-
- <xsl:template match="*">
- <xsl:element name="{local-name()}">
- <xsl:apply-templates select="@* | node()"/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="@* | text()">
- <xsl:copy/>
- </xsl:template>
- </xsl:stylesheet>
lets say that what I have is
< soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:q0="http://address" >
< soapenv:Body>
< q0:findByLocation>
< city/>
< state>NC< /state>
< /q0:findByLocation>
< /soapenv:Body>
< /soapenv:Envelope>
and I want to change namespace q0 to be "http://east.address"
then how do i do that?
I'm looking for a solution for a similar problem did you find a solution if so please share it.