Re: [xsl] How namespaces are unique???

Subject: Re: [xsl] How namespaces are unique???
From: Peter Davis <pdavis152@xxxxxxxxx>
Date: Thu, 30 May 2002 05:36:39 -0700
Hash: SHA1

On Thursday 30 May 2002 05:05, Mailer Mailer wrote:
> both had namespace definition like this:
> xmlns:calp="";
> xmlns:calp-"";
> Can anyone explain me how namespace is resolving the
> conflict, when the these prefix names are same???

As I'm sure many people will tell you, the prefix **doesn't matter at all**.  
It is what comes after the prefix that counts.  In fact, if you do 
xmlns="...", you can have a namespace without a prefix at all.

The following elements are all completely equivilant:

<foo xmlns="bar"/>
<prefix:foo xmlns:prefix="bar"/>
<xx:foo xmlns:xx="bar"/>

And the following elements are all totally different:

<prefix:foo xmlns:prefix="bar"/>
<prefix:foo xmlns:prefix="zap"/>
<foo xmlns="zoip"/>
<foo xmlns="xyz"/>

The prefix is merely a shorthand way of telling the XML processor which URI is 
associated with the element.  The processor uses whatever xmlns declaration 
for a given prefix is in scope.  So even if two elements with the same 
prefixes exist in a single document, they can have different namespaces and 
therefore be totally different elements:

  <element xmlns:prefix="bar">
  <element xmlns:prefix="zap">
    <!-- this <foo> is different from the first -->

The only thing that matters is the URI that is the value of the xmlns 
declaration.  If the two URIs are not *exactly* the same, then any elements 
using the prefixes associated with the different URIs will be in different 

The fact that most URIs take the form of ""; does not mean 
that the server at is contacted at all.  Think of the URI as merely a 
string of characters that has nothing to do with any actual internet 
protocol.  Even if and resolve to the same server, 
""; and ""; will be 
different namespaces.

BTW, have you ever heard of google?  I find it hard to believe that this 
question has not already been answered thousands of times :)

- -- 
Peter Davis
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see


 XSL-List info and archive:

Current Thread