xsl-list
[Top] [All Lists]

Re: [xsl] Namespaces conventions: Why ALWAYS "http:..." tags ?

2007-02-01 05:43:25
Hi Ben,

This sounds like an XML question to me, which when asked on an XML list may yield better responses.

A namespace is defined as a URI. That is a very general form and included the URN and the URL specifications. The 'http:' version is not mandatory in whatever way, but falls under the "URL" type of URI. Microsoft, and I believe OASIS as well sometimes, rather choose URNs instead (like: "urn:microsoft:excel"). There are pros and cons for either of them.

Whether you use 'http' is up to you. You can use 'file' for that matter, or 'didgeridoo'. You are right in that it does not resemble a physical resource.

The most heard reason for using 'http' + domain name is because the http protocol is already defined to be globally unique. So, if you have to choose a namespace and you want to make sure that there are no name clashes, your best bet is to use the http protocol, which is widely known and conveniently fits the requirements. Not so with URNs. Which is why often companies internally choose URNs and for public namespaces choose http URLs (but, compare Microsoft, this is not a requirement and is a matter of taste, really).

Note that relative URLs are discouraged, but they are still allowed.

Much more can be said about pros/cons and naming. I personally, after getting used to it, have found it rather convenient to use http URLs and it saved me many headaches of having to think of yet another naming convention.

Many hints and best practices about namespaces are found here: http://www.xfront.com/BestPracticesHomepage.html

From my point fo view it is just a tag or label which could be named
No, it is not a tag or label. You may compare it with an instruction space, language name or scope (but all fail to cover namespaces, really). The namespace prefix can be compared to a tag or label, and can be chosen freely, regardless of the namespace itself.

Cheers,
-- Abel Braaksma
  http://www.nuntia.nl




Ben Stover wrote:
Whenever I looked into XSLT stylesheets with namespace declarations I see
ALWAYS a scheme like

xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

or more general

xmlns:foo="http://www.somedomain.com/foobarlabel";

This is somehow confusing because the namespace has nothing to do with a WWW 
Hyperlinks/URLs.
>From my point fo view it is just a tag or label which could be named xmlns:foo="aabbccdd"
as well
Or is there somewhere a specs which requires a "http...." declaration

What is the reason why all the coders use "http...." URL like namespace names ?

Ben



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--