xsl-list
[Top] [All Lists]

Re: Default namespace problem

2005-09-01 08:35:17

You mean the second one is in no space, not the first one, correct?

No, he meant what he said.


And this one with prefix is specified namespace:
<OrderRequest xmlns:bt="http://www.csgsystems.com/bta";>

No. That binds the prefix bt to the namespace
http://www.csgsystems.com/bta
so element names prefixed by bt: would be in tha namespace, but as this
element is unprefixed this namespace binding nas no effect on this
element. (It would have an effect on children of this element that have
a bt: prefix).


So namespaces link an XML and XSLT file thru the URI, not the prefix.  

The namspace spec goes to some lengths to stress that prefixes are not
to be consided as important
<foo xmlns="ns"/> <x:foo xmlns:x="ns"/> <y:foo xmlns:y="ns"/>
all mean the same thing, just as they all mean the same as
<foo   xmlns='ns'/>   <x:foo   xmlns:x   ='ns'/> <y:foo   xmlns:y='ns'/>

So XSLT is more or less forced to use the URI not the prefix.

But these seems to be confusing to many programmers, and that's why it
should have been changed in XSLT 2.0.  I still use XSLT 1.0 though.

This part is the same in XSLT2 and in any other application that
supports XML namespaces. What is different in xpath2 is that you can
specify that an unprefixed name in xpath denotes a namespace other than
the null namespace, so if your xpath default element namespace is
"ns" then select="foo" will select foo in that namespace so it will
not select
<foo/>
but will select any of the forms listed above:
<foo xmlns="ns"/> <x:foo xmlns:x="ns"/> <y:foo xmlns:y="ns"/>

It remains to be seen whether this will be more or less confusing to
people. personally I see it as sometimes useful, but more likely to be a
source of confusion than a source of help.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>