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

Re: Namespaces

xslt drop namespaces
Hi Mike,

> Seriously, a) what specific ways do namespaces bite people who
> understand them and use software that supports them properly? b)
> What should one do to avoid being bitten, given that they are
> pervasive? c) How would one do it differently in 20:20 hindsight?

On (c) I suspect many people would say "drop namespaces altogether".
But namespaces are very useful in the languages that I work with (e.g.
XSLT), so while designing LMNL [1] instead of just getting rid of them
we tried to rethink them so that they would be less problematic. We
decided to make the following changes to the way XML handles

  1. Keep namespace declarations for markup (element/attribute names)
     and namespace declarations for content (element/attribute values)
     separate. Attributes are fine for the latter, but the former
     should really be done through something at the syntax level --
     ideally dedicated namespace declarations.

     The fact that the two levels of namespaces are merged in XML
     means that it's impossible to tell which namespace prefixes can
     be changed and which can't, which makes canonicalisation and
     comparisons between XML documents very difficult. It also
     increases the burden on implementations because they have to keep
     track of the in-scope namespaces for each element whereas if they
     didn't have to worry about prefixes in content they could
     reconstruct the required (markup-level) namespace declarations
     from the namespace URIs of elements and attributes.

     I also think that this makes sense because the namespaces that
     are in-scope for a particular piece of content can be application
     dependent. XQuery and XPath have examples of this, where there
     are several "default namespaces" in play -- one for element names
     in location paths, one for function names, and another for
     elements that are getting generated. In other words, there can be
     several sets of "in-scope namespaces" at the content-level, so it
     makes sense for those to be controlled through an
     application-specific mechanism.

  2. Enforce sanity, as defined at:


     by saying that once a (markup-level) namespace is declared, it
     cannot be re-declared in the same document unless it has the same

  3. Don't have a default namespace -- if something has a prefix
     it's in a namespace; if it doesn't, it's not. This prevents
     confusion over "qualified" vs. "unqualified".

  4. (A general thing, but has a particular impact with namespaces)
     Have an option to retain user-specified but syntax-level
     artifacts such as namespace prefixes, so that identity
     transformations (for example) are able to create
     identical-looking XML. For some reason, users grow attached to
     the prefixes that they use and get upset when they're substituted
     for 'ns0', despite the fact that the expanded names are just the



[1] http://www.lmnl.org/

Jeni Tennison


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.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.