Re: [xsl] namespace scope

Subject: Re: [xsl] namespace scope
From: Oleg Tkachenko <olegt@xxxxxxxxxxxxx>
Date: Thu, 02 May 2002 17:09:29 +0200
That's because you are creating <mutcode> elements with no namespace.
Or set your namespace to be default one, by xmlns="urn:nollekens.be" or
create elements in the namespace explicitly by <nol:mutcode>NEW</nol:mutcode>.


Joeri Belis wrote:
I am doing an XML to XML copy and need to add a few new elements.
The copy is fine but why are my added elements outputted with 2 xmlns
attributes?

An empty one and an our namespace. I have definined it at the top in
xls:stylesheet.
xmlns=""
xmlns:nol="urn:nollekens.be"

I tried to include a the parts that seems import to explain the problem

The input XML file
<?xml version="1.0"?>
<root xmlns="urn:nollekens.be">
...
  <offertelijn>
  ...
  </offertelijn>
</root>

XLST stylesheet looks like this

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:nol="urn:nollekens.be">
...
<xsl:template match="nol:offertelijn">
  <xsl:copy>
    ...
    <xsl:choose>
      <xsl:when test="nol:referteklant = ''">
        <mutcode>NEW</mutcode>
      </xsl:when>
      <xsl:otherwise>
        <mutcode>MOD</mutcode>
      </xsl:otherwise>
    </xsl:choose>

  </xsl:copy>
</xsl:template>

output XML file (copied fields are exact like in my source XML )
but the added fields have the 2 ns attributes
   <mutcode xmlns="" xmlns:nol="urn:nollekens.be">MOD</mutcode>

Thanks for any feedback,
Joeri



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list




-- Oleg Tkachenko Multiconn International, Israel


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread