XSLT namespace question

M

Mikko Nummelin

As the XSLT namespace is declared to be used in XSL documents like this:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

, isn't this a risky practice as it refers to an external web site and if
that web site is down at a particular time or is moved to another place,
then even large web sites referring to it may fall down with it. So, is it
possible to obtain a local copy of such a namespace and refer to it in
further applications as

<xsl:stylesheet version="1.0"
xmlns:xsl="http://localhost/XSL/Transform">

or in a similar way? Which files are important and where to obtain them?


Mikko Nummelin
 
K

Keith Davies

As the XSLT namespace is declared to be used in XSL documents like this:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

, isn't this a risky practice as it refers to an external web site and
if that web site is down at a particular time or is moved to another
place, then even large web sites referring to it may fall down with
it. So, is it possible to obtain a local copy of such a namespace and
refer to it in further applications as

the string attached to a namespace definition is just that -- an
arbitrary string. The engine doesn't download anything from a URI that
may be in that string. If w3 deletes that directory it will have *no*
effect on your processing.

It is customary to base the namespace key on the web site of the
creator, and to have documentation on the components of the namespace at
that location, but it is not required.

When processing XML data in a program, most (I can't say all) libraries
will provide things in the form of (name,namespace). What your program
will see is actually something more like ('template',
'http://www.w3.org/1999/XSL/Transform') than 'xsl:template'. If it
isn't in the namespace identified by that URI, an XSLT engine won't
recognize the element as being XSLT.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://localhost/XSL/Transform">

or in a similar way? Which files are important and where to obtain
them?

there are no files to obtain. A namespace is little more than a
qualifier used to correctly identify an XML component.


Keith
 
M

Mikko Nummelin

the string attached to a namespace definition is just that -- an
arbitrary string. The engine doesn't download anything from a URI that
may be in that string. If w3 deletes that directory it will have *no*
effect on your processing.
It is customary to base the namespace key on the web site of the
creator, and to have documentation on the components of the namespace at
that location, but it is not required.
When processing XML data in a program, most (I can't say all) libraries
will provide things in the form of (name,namespace). What your program
will see is actually something more like ('template',
'http://www.w3.org/1999/XSL/Transform') than 'xsl:template'. If it
isn't in the namespace identified by that URI, an XSLT engine won't
recognize the element as being XSLT.
there are no files to obtain. A namespace is little more than a
qualifier used to correctly identify an XML component.

Sorry for my stupidity. IMO, using variable or file names of that type is
extremely misleading and comparable to a malpractice of naming the further
Linux kernel gzip packets in a way like

http://www.microsoft.com/2.6.1

/dev/null/2.4.27heydude

, which are, well, valid UNIX file names, but ...


Mikko Nummelin
 
P

Patrick TJ McPhee

[About the convention of using http: urls for name spaces]

% Sorry for my stupidity. IMO, using variable or file names of that type is
% extremely misleading and comparable to a malpractice of naming the further
% Linux kernel gzip packets in a way like

% http://www.microsoft.com/2.6.1
%
% /dev/null/2.4.27heydude
%
% , which are, well, valid UNIX file names, but ...

The problem is that you need to have a globally unique identifier. What
would you like to use, that you can guarantee nobody else will use, or
at least you can claim they're not being reasonable if they do use it?
People started using http: protocol URIs because the network address
is guaranteed to be unique and people can reasonably expect to
control the URIs associated with addresses that they `own'.

Someone could have defined a protocol for name spaces, like

ns://www.w3.org/1999/XSL/Transform

and saved everyone a lot of trouble, because the convention of putting
documentation at the web address used for name-spaces only arose _after_
lots and lots of people just assumed they'd find documentation there,
and raised a fuss.

Anyway, I think it's more confusing than misleading (certainly not
`extremely misleading'. I have no idea what your analogy is supposed
to mean (it's also confusing), but it seems likely that it's not
particularly apt. Nothing has been mislabled, there's just a URI
being used in a context which doesn't suggest there are any resources
assoicated with it, and which has no resources associated with it.
 
D

Dimitre Novatchev

Sorry for my stupidity. IMO, using variable or file names of that type is
extremely misleading and comparable to a malpractice of naming the further
Linux kernel gzip packets in a way like

http://www.microsoft.com/2.6.1

/dev/null/2.4.27heydude

, which are, well, valid UNIX file names, but ...


Namespaces are used in programming languages -- C++ or C# -- what's so
"misleading" about this? This is a useful feature. One needs to read more
before making striking statements...


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
 
R

Richard Tobin

Mikko Nummelin said:
Sorry for my stupidity. IMO, using variable or file names of that type is
extremely misleading and comparable to a malpractice of naming the further
Linux kernel gzip packets in a way like

http://www.microsoft.com/2.6.1

Obviously it would be unwise to use Microsoft's domain name to name
Linux objects :)

But the point of using URIs is that it's easy to construct names that
will be unique, by using your own domains. All W3C namespace names
are URIs beginning http://www.w3.org, for example. There's no need
for a registry of namespace names, and it's easy to see who is
responsible for the namespace.

Whether there is anything at the location specified by the URI is up
to you. Often there is a schema, or a RDDL file, or a textual
description of the namespace. Again, it would be unwise to put an
unrelated document there. But the main purpose of namespaces is to
disambiguate names, and for that purpose there is no need to
dereference the name at all.

-- Richard
 
C

Chris Lovett

I like the convention of being able to browse to a given XML namespace URI
and read up on what this namespace is all about. For example, there are
web pages at http://www.w3.org/1999/XSL/Transform, I think this is cool --
it is the ultimate in global online help for programmers. There's even
opportunities here for folks to provide richer web sites with their schemas,
provide a list of tools that know how to process that namespace and so on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top