Hi Christian,


On Mon, Jan 2, 2017 at 5:55 AM, Christian Grün <christian.gruen@gmail.com> wrote:
Hi Bridger,

Sorry for letting you wait:

It's no trouble at all -- thank you for your time and trouble.
 

> and it works fine so long at the <relatedItem> is not namespaced.

I tried to further strip down your code. Do you think that the
following examples are equivalent?

WORKS:

  let $content := document { <root>BLA</root> }
  return <item>{ $content/root }</item>

DOES NOT WORK:

  let $content := document { <root>BLA</root> }
  return <item xmlns='ns'>{ $content/root }</item>

HA! That's a *much* better expression of the problem - thank you for condensing it!
 
This is indeed compliant with the spec. The hint may be a bit hidden,
but the spec states that “[…] the default element/type namespace may
be affected by namespace declaration attributes found inside the
element constructor.”.

I agree that the decision is somewhat counterintuitive, because you
would expect that moving your code to a different place will not
change its behavior.

Hope this helps,
Christian

Absolutely. Again, thank you kindly for your help!
Happy New Year.
Best,
Bridger

 
[1] https://www.w3.org/TR/xquery-31/#id-element-constructor



>
> The input documents (in the SSCCE, under sample-data/*/metadata.xml) are not
> in a namespace.
>
> Would someone mind providing some context for the "why" here? I've been
> looking through Priscilla Walmsley's 2nd edition, and the specification, but
> haven't been able to find an answer. I'm almost certainly looking for the
> wrong thing(s).
>
> Any help will be greatly appreciated! Thank you in advance.
> Best,
> Bridger