Hi all,
I just come across an issue, and I am not sure if I am too stupid to see the mistake, or it is a bug in BaseX.
I need to create an XML document from data in BaseX 11.5 inside basexgui. The data in the database does not use any namespaces. The document I am creating must have a default namespace set. Here is a stripped down example of my XQuery:
for $w in /json/workouts/_/header[uuid='123'] return
<gpx xmlns="http://www.topografix.com/GPX/1/1" >
<title>{$w/title/text()}</title>
</gpx>
Strangely all XPaths inside and outside the gpx-element will not match anything as long as I have the default namespace on the gpx-element defined. It works if I drop the xmlns attribute or I define the namespace explicitly, like:
for $w in /json/workouts/_/header[uuid='123'] return
<g:gpx xmlns:g="http://www.topografix.com/GPX/1/1" >
<g:title>{$w/title/text()}</g:title>
</g:gpx>
Even though this should be semantically equal to the output of the above, the third party app that I import this to does not recognize it as such.
This is puzzling me mainly because I do not see, why the namespace I define for the *output* xml should have an impact on the queries that are directed to my database. As a workaround I will probably use a regex to remove the namespace, but that's obviously pretty awkward.
Any ideas?
Cheers
Jörn