Re: [xsl] Replacing default namespace

Subject: Re: [xsl] Replacing default namespace
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Sat, 30 Jun 2007 14:32:22 +0200
Scott Sauyet wrote:

The root <definitions> tag in the original WSDL has

xmlns:tns="http://tempuri.org/";

Now throughout the document, elements that look like these:

    <xs:simpleType name="addrFormat" .../>
    <service name="SessionsService" .../>

get transformed into these:

    <xs:simpleType xmlns:tns="http://tempuri.org/"; name="addrFormat">
    <service xmlns:tns="http://tempuri.org/"; name="SessionsService">

If you use xsl:copy then namespace nodes are copied through too when an element node is copied. To avoid that use a template like this


  <xsl:template match="*">
    <xsl:element name="{name()}" namespace="{namespace-uri()}">
      <xsl:apply-templates select="@* | node()"/>
    </xsl:element>
  </xsl:template>

for element nodes that you want to copy without its namespaces nodes.


--


	Martin Honnen
	http://JavaScript.FAQTs.com/

Current Thread