Hi Folks,
I want to transform this:
--------------------------------------------
<t:Test xmlns:t="http://www.test.org"
xmlns:unused="http://www.unused.org"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<t:faultcode>SOAP:client</t:faultcode>
</t:Test>
--------------------------------------------
to this:
------------------------------------
<Test xmlns="http://www.test.org"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode>SOAP:client</faultcode>
</Test>
------------------------------------
That is, I want to:
1. Replace namespace-qualified elements with a default namespace, e.g.,
Change this: <t:Test xmlns:t="..."
to this: <Test xmlns="..."
2. Delete unused namespace declarations, e.g.,
Delete this: xmlns:unused="..."
3. Retain a namespace declaration if it declares a namespace prefix that is
used in an element QName value, e.g.,
Retain this: xmlns:soap="..."
because the prefix is used in this element's value:
<faultcode>SOAP:client</faultcode>
The following template rule does (1) and (2) but fails to implement (3):
<xsl:template match="*[namespace-uri()]">
<xsl:element name="{local-name()}"
namespace="{namespace-uri()}">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
Any ideas? I am using XSLT 1.0
/Roger
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--