[xsl] namespace scope

Subject: [xsl] namespace scope
From: "Joeri Belis" <joeri.belis@xxxxxxxxxxxx>
Date: Thu, 2 May 2002 15:50:31 +0200
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


Current Thread