[xquery-talk] Namespace question wrt. XQTS and
XQuery/XSLT2Serialization spec
Wolfgang Hoschek
wolfgang.hoschek at mac.com
Sun Nov 13 10:20:00 PST 2005
>
> So the question is the same as asking whether the serializer
> retains all the
> namespaces of an element, or only those that are actually used. The
> answer
> is that it can't know which namespaces are actually used (because
> of the
> possibility of namespace-sensitive content) so it retains them all.
>
>
>> I noticed that W3C XQTS requires method 2) at times due to Canonical
>> XML comparison, e.g. for SeqUnion/fn-union-node-args-015.xq et al.
>>
>
> This shows up a deficiency in the test driver I have been using for
> testing
> Saxon. I'm comparing results using the deep-equals() method, which
> doesn't
> require two elements to have the same in-scope namespaces in order
> to be
> deep equal. A more rigorous comparator would have spotted this
> error in the
> published test results.
So far I'm using the (awkward) serialization and reparse test route.
This way such issues do show up.
>
> Saxon's actual results for this query are:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <atomic:integer xmlns:atomic="http://www.w3.org/XQueryTest"
> xmlns:foo="http://www.example.com/foo"
>
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-
> instance">12678967543233</atomic
> :integer>
Nux's actual results are identical to Saxon's. So the morale of the
story is that there seems to be yet another bug in the XQTS test cases.
For example in
SeqUnion/fn-union-node-args-015.xq and friends
SeqIntersect/fn-intersect-node-args-014.xq and friends
SeqExcept/fn-except-node-args-017.xq
As noted by others, the XQTS test cases seem to have many inaccuaries/
bugs. In fact more than Saxon and Nux combined.
>
> There's a possible question about what happens if you specify
>
> declare copy-namespaces no-preserve, no-inherit;
>
> This query is not actually creating or copying any nodes, so the
> prolog
> declaration wouldn't appear to make any difference. Serialization
> does copy
> the element (Serialization section 2 rule 1) but I don't think a copy
> operation performed by the serializer is subject to the copy-
> namespaces
> declaration (which can vary, after all, from one query module to
> another).
> If you do this, however:
>
> declare copy-namespaces no-preserve, no-inherit;
> document {
> ($input-context/atomic:root/atomic:integer) union
> ($input-context/atomic:root/atomic:integer)
> }
>
> then the element node is copied, and the redundant namespaces are
> therefore
> dropped.
>
> If you're using XML 1.1 you can specify xmlns:foo="", and the foo
> namespace
> will then not be in scope for this element, and no namespace
> declaration
> will therefore be output by the serializer.
IMHO, serialization semantics should independent of whatever the
query reads. In other words the input to serialization is a sequence,
rather than a sequence + query + namespaces.
Wolfgang.
More information about the talk
mailing list