[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Default namespace problem

Subject: Re: Default namespace problem
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 1 Sep 2005 16:35:17 +0100
xpath default namespace problem
> 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
________________________________________________________________________

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.