[xquery-talk] Wrap element constructor and output disappears

Ihe Onwuka ihe.onwuka at gmail.com
Sun May 24 08:55:46 PDT 2020


current state of play

https://stackoverflow.com/a/61987989/1461707

On Sun, May 24, 2020 at 11:44 AM Ihe Onwuka <ihe.onwuka at gmail.com> wrote:

> Apparently works in MarkLogic but not in eXist-db
>
> On Sun, May 24, 2020 at 11:05 AM Ihe Onwuka <ihe.onwuka at gmail.com> wrote:
>
>> This seems to be an eXist-db problem as someone on SO reports the code
>> works for them.
>>
>> The surrounding element constructor is causing the code to not return
>> anything at all.
>>
>>
>>
>> <parameters>{
>> let $root := <a:b xmlns:a="ans" xmlns:c="cns"/>
>>      for $prefix in in-scope-prefixes($root)[not(. = ('xml', 'xsi'))]
>>       return
>>           namespace-uri-for-prefix($prefix,$root) !
>>               <param name="{$prefix}" value="{.}"/>
>> }</parameters>
>>
>> ---------- Forwarded message ---------
>> From: Ihe Onwuka <ihe.onwuka at gmail.com>
>> Date: Sun, May 24, 2020 at 9:14 AM
>> Subject: Wrap element constructor and output disappears
>> To: <talk at x-query.com>
>>
>>
>> Also posted on SO
>> https://stackoverflow.com/questions/61986249/cannot-wrap-element-around-xquery-output but
>> happy to get an answer anywher.
>>
>> Returning to XQuery after a long hiatus.
>>
>> let $root := <a:b xmlns:a="ans" xmlns:c="cns"/>
>>      for $prefix in in-scope-prefixes($root)[not(. = ('xml', 'xsi'))]
>>       return
>>           namespace-uri-for-prefix($prefix,$root) !
>>               <param name="{$prefix}" value="{.}"/>
>>
>> gives the expected
>>
>> <param name="a" value="ans"/>
>> <param name="c" value="cns"/>
>>
>> But if I try to wrap an element around that output like below nothing is
>> returned
>>
>> <parameters>{
>> let $root := <a:b xmlns:a="ans" xmlns:c="cns"/>
>>      for $prefix in in-scope-prefixes($root)[not(. = ('xml', 'xsi'))]
>>       return
>>           namespace-uri-for-prefix($prefix,$root) !
>>               <param name="{$prefix}" value="{.}"/>
>> }</parameters>
>>
>> So what is wrong and how do I wrap the output in a parameters element?
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://x-query.com/pipermail/talk/attachments/20200524/666e4c7f/attachment.html>


More information about the talk mailing list