RE: [xsl] Idea to relax default ns handling in XPath 1.0

Subject: RE: [xsl] Idea to relax default ns handling in XPath 1.0
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 31 Oct 2005 19:56:51 -0000
I think conformance to the spec is more important than (superficial)
convenience to users. The XPath 1.0 spec says that "no prefix means no
namespace", and introducing a default namespace would make your
implementation non-conformant with XPath 1.0. That would confuse users more
than the current situation does, for example when they try to cut-and-paste
XPath expressions from one environment to another.

Adding a method call setDefaultElementNamespace("http://foo/";) is not
significantly easier than adding the prefix "foo:" to each of the element
names and calling setNamespace("foo", "http://foo/";). The real usability
problem here is not the difficulty of adding the prefixes to the names, it's
the fact that people don't realize that they need to do it. You're not
stopping people from falling into this particular hole, all you're doing is
enabling them to climb out of it with fewer keystrokes, but by then the
damage has been done, they've already torn their hair out working out what's
gone wrong.

If you do have such a facility (and I would advise against), then make sure
that it only applies to unqualified element names and not to unqualified
attribute names. See the concept of "default namespace for elements" in
XPath 2.0 for guidance.

I have to say that the discussion on the bugzilla entry is extremely
confused, which doesn't bode well for coming up with a clean spec. 

Michael Kay
http://www.saxonica.com/



> -----Original Message-----
> From: Antonio Gallardo [mailto:agallardo@xxxxxxxxxxxxxxxxxxxxxxx] 
> Sent: 31 October 2005 18:25
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Idea to relax default ns handling in XPath 1.0
> 
> Hi:
> 
> In Apache commons-jxpath we discuss a simpler way to relax 
> the XPath 1.0
> handling for default namespaces:
> 
> http://issues.apache.org/bugzilla/show_bug.cgi?id=32360
> 
> Basically, the solution introduce a special handling flag for default
> namespaces:
> 
> http://issues.apache.org/bugzilla/show_bug.cgi?id=32360#c13
> 
> I will be glad if you can comment about the issue and how do 
> you see this.
> 
> Many thanks in advance.
> 
> Best Regards,
> 
> Antonio Gallardo.

Current Thread