Subject: Re: [xsl] How namespaces are unique??? From: Peter Davis <pdavis152@xxxxxxxxx> Date: Thu, 30 May 2002 05:36:39 -0700 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 30 May 2002 05:05, Mailer Mailer wrote: > both had namespace definition like this: > > xmlns:calp="http://url1.com/meta/calp" > > xmlns:calp-"http://url2.com/bit/calbit" > > > 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: <document> <element xmlns:prefix="bar"> <prefix:foo/> </element> <element xmlns:prefix="zap"> <!-- this <foo> is different from the first --> <prefix:foo/> </element> </document> 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 namespaces. The fact that most URIs take the form of "http://foo.com/..." does not mean that the server at foo.com 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 www.foo.com and www2.foo.com resolve to the same server, "http://www.foo.com/namespace" and "http://www2.foo.com/namespace" 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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE89hzcNSZCJx7tYycRAsqNAJ9+ei3vVjVEwrvuTNmW7DF0iZrN7wCfZECt qVX2qsxrTo4bJRIv1UfNcRE= =EfE8 -----END PGP SIGNATURE----- XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] How namespaces are unique???, Mailer Mailer | Thread | Re: [xsl] How namespaces are unique, David Carlisle |
[xsl] separator defninition, NILESH PATEL | Date | [xsl] Date format, AXRAMAKR |
Month |