This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Should the declared prefixes be serialized? Ex 1: explicit declaration declare namespace cat ='mycat'; <a t='cat:miau'>42</a> Should result in: <a t='cat:miau'>42</a> or <a xmlns:cat='mycat' t='cat:miau'>42</a> Ex 2: implicit declaration of xsi and xs prefix <a xsi:type='xs:integer'>42</a> Should result in: <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:integer">42</a> or <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:integer">42</a> Should the validate expression take into account the declared prefixes? Ex 3: validate validate lax { <a xsi:type='xs:integer'>42</a> } Should result in: Error: xs prefix not declared for QName value 'xs:integer'. or <a xsi:type='xs:integer'>42</a> with 'xs:integer' being a valid QName and 42 being an integer in PSVI.
I believe this is really a request for interpretation of the XQuery 1.0 specification, rather than a comment on 3.0. Correct me if I am wrong. Note first that the serializer makes no decision about which namespaces to output. If a namespace is present in the result tree then it is serialized, if it is not present in the result tree, it is not serialized. The question concerns element construction and the namespace nodes/bindings that are added to elements during tree construction, which is largely covered in section 3.7.4 of the specification, and has nothing to do with serialization. For the first example declare namespace cat ='mycat'; <a t='cat:miau'>42</a> none of the conditions for creating a namespace binding for cat="mycat" is satisfied; therefore it is not created. (If you want it created, write <a t='cat:miau' xmlns:cat='mycat'>42</a>) In the second example, the required conditions are satisifed for the xsi namespace (specifically, the namespace is used in the name of an attribtue), but not for the xs namespace. As far as validation is concerned, the tree is constructed first, then validation takes place. The only namespaces known to the validator are those that are present on the tree being validated. If tree construction did not add a namespace to the element in question, then the validator will complain if it encounters QName-valued content that uses a prefix for which no binding is present on the tree.
Hi Cezar, Do you agree with Mike Kay's analysis? Is there a bug in the XQuery 3.0 specificaiton that we should be aware of? If not, I'd like to close this BZ.
Hi Cezar, I'm resolving this as invalid, because it does not mention a specific problem with the XQuery 3.0 specification. If I missed something, please reopen, and clearly state the problem that you see in the specification.
This is how I interpreted the first time, without these examples. But from an usability standpoint, in these cases, it's not the best answer. In the same time, the spec has to cover all cases, it's good that this is clarified now.
It would be really useful to have a set of tests added to the TCK for this matter.
Thanks for the suggestion. I am adding these examples as tests to the QT3 test suite. In fact it appears there are currently no tests for a validate expression relying on xsi:type, so this is a welcome addition!