Hi,
I am using the sample xml document(xyz) shown below:
<libx:libapp> First libapp </libx:libapp>
<libx:libapp> Second libapp </libx:libapp>
</entry>
I am using BaseX 6.5.2 and am trying to use a variable along with a namespace prefix in my sample xquery like so:
declare variable $libx_ns as xs:string external;
declare namespace libx=$libx_ns;
let $type := 'libapp'
return doc('xyz')/entry[libx:{$type}][1]
When I pass the value "
http://libx.org/xml/libx2" to the parameter libx_ns and run the above xquery I see the following exception:
[XPST0003] Incomplete expression.
However, the following xquery works:
declare variable $libx_ns as xs:string external;
declare namespace libx=$libx_ns;
let $type := 'libapp'
return doc('xyz')/entry[libx:libapp][1]
The child nodes could be libx:libapp or libx:module etc. So, I will have to use a variable rather than hard wiring the actual child name. But, I am not sure how to use a variable along with a namespace prefix. Am I doing something wrong or is this a bug ?
Thanks,
Sony