[xquery-talk] Namespace question wrt. XQTS and XQuery/XSLT2 Serialization spec

Wolfgang Hoschek wolfgang.hoschek at mac.com
Sun Nov 13 08:40:07 PST 2005


I'm wondering what the correct output of the XML Output Method of the  
W3C XQuery/XSLT2 Serialization Spec is wrt. inclusion of namespaces  
declared on ancestors in the context of subtrees. There are at least  
two interpretations:

Example:
         doc :=
         <SOAP:a xmlns:SOAP="http://schemas.xmlsoap.org/soap/ 
envelope/" xmlns:foo="http://example.com">
             <b>
                 <SOAP:c/>
             </b>
         </SOAP:a>

result sequence := /*:*/b

1) Output method 1 adds all namespaces-in-scope to the subforest's  
root, generating the following output:

         <b xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"  
xmlns:foo="http://example.com">
             <SOAP:c/>
         </b>

2) Output method 2 omits superflous namespaces declarations, treating  
the subforest's root as if it had no ancestors:

         <b>
             <SOAP:c xmlns:SOAP="http://schemas.xmlsoap.org/soap/ 
envelope/"/>
         </b>

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.  
Which one is correct?
[I can easily implement either approach once it's clear which route  
to prefer]

Thanks,
Wolfgang.






More information about the talk mailing list