An unexpected phenomenon has arisen in the XQuery course I'm teaching today and tomorrow; I wonder if anyone on this list can shed any light on it.
To reproduce:
1 build a database containing the document http://blackmesatech.com/2012/06/data/sonnet92.xml
2 evaluate the following expressions
(a) . (displays the entire document)
(b) ./* (ditto)
(c) declare namespace n = "http://www.tei-c.org/ns/1.0"; ./n:TEI (again returns entire document)
This one didn't surprise me; it's what I expected.
(d) /TEI (ditto)
This one surprised me, since the TEI element in the document is namespace-qualified, and I would not have expected the expression to match anything.
At this point, I would be tempted to say "well, maybe when we built the database, BaseX set the default element namespace in the static context to the TEI namespace." That would explain the evaluation of this expression.
But ...
(e) ./TEI (returns nothing)
If the default element namespace in the static context were the TEI namespace, I would expect this to work. If it were NOT the TEI namespace, I would expect (d) to fail.
I'm having trouble explaining to the participants in my course (or to myself) why expressions (d) and (e) return different results.
What am I missing?
best regards,
Michael Sperberg-McQueen