explicit use of namespace prefixes in xquery expressions does not appear to work

Saturday, 25 September 2010 · 2 messages
LW
Leonard Wörtelerin reply to Godmar Back, 25 Sep 2010, 20:2325 Sep 2010 20:22 #

Hi Godmar,

Quoted text · Godmar Back · 10 lines
Am 25.09.2010 18:24, schrieb Godmar Back: > (the inherited default name space for the libx:entry element is > 2005/Atom. But explicitly asking for atom:src in the query: > > declare namespace libx='http://libx.org/xml/libx2'; > declare namespace atom='http://www.w3.org/2005/Atom'; > doc("libx2_feed")//libx:entry[@atom:src="34"] > > returns an empty sequence when in my opinion it should provide the same > result. Am I wrong?

quoting "Namespaces in XML 1.0 (Third Edition)" [1]:

Quoted text · Godmar Back · 2 lines
> The namespace name for an unprefixed attribute name always has no > value.

In conclusion attributes don't inherit namespaces, so I think there's nothing wrong with this particular behaviour.

I'll look into your databases now, thank you very much for that. Damn little namespace thingies... Greets Leo __________ [1] http://www.w3.org/TR/REC-xml-names/#defaulting

GB
Godmar Back25 Sep 2010 20:23 #

I'm trying to create snapshots for the problems we're having with namespaces.

Here's the first one (this is not a showstopper, just something I believe is wrong).

In http://top.cs.vt.edu/~gback/bx/nsbug1/ you can find http://top.cs.vt.edu/~gback/bx/nsbug1/BaseXData.bug1.zip which contains a zipped BaseX folder. The script 'test.sh' demonstrates what I believe to be a problem with 6.2.7.

Notably, the following query:

declare namespace libx='http://libx.org/xml/libx2'; doc("libx2_feed")//libx:entry[@src="34"]

returns:

<libx:entry xmlns:libx="http://libx.org/xml/libx2" xmlns="
http://www.w3.org/2005/Atom" src="34"/>

(the inherited default name space for the libx:entry element is 2005/Atom. But explicitly asking for atom:src in the query:

declare namespace libx='http://libx.org/xml/libx2';
declare namespace atom='http://www.w3.org/2005/Atom';
doc("libx2_feed")//libx:entry[@atom:src="34"]

returns an empty sequence when in my opinion it should provide the same result. Am I wrong?

(As an aside, using libx:src also doesn't return anything:)

Run test.sh to reproduce.

- Godmar


⚡Generated with XQuery