Transforming some search:parse() XML output using the recursive typeswitch 
pattern, I discovered that the namespace in cts:element would not copy:

<cts:element-range-query qtextpre="My-facet:" qtextref="cts:annotation" 
operator="=">
  <cts:element xmlns:_1="http://xyz.com/xq/my-prefix";>_1:my-facet</cts:element>

copy-namespaces options have no effect, evidently because the namespace is not 
used on any descendant nodes, so it's always dropped regardless of the 
declaration.

I got it to copy with $n/namespace::*; however, I've read several threads 
suggesting that axis is actually deprecated in XQuery, and also the spec, which 
seems to contradict itself:

"XQuery does not support the namespace axis and does not represent namespace 
bindings in the form of nodes. However, where other specifications such as 
[XSLT 2.0 and XQuery 1.0 Serialization (Second Edition)] refer to namespace 
nodes, these nodes may be synthesized from the in-scope namespaces of an 
element node by interpreting each namespace binding as a namespace node."

Is it safe to use the namespace axis now and in the future? I have seen several 
elaborate workarounds for copying unused in-scope namespaces without it, but 
this would be much easier.

Thanks!

Will

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to