Re: c14n/exc-c14n interop samples

Hi Aleksey;

r/aleksey@aleksey.com/2002.05.31/10:40:46
>Thanks for your explanation. I agree with you that your result
>seems correct. However, the C14N spec has following example:
>
>Section 3.3 (http://www.w3.org/TR/xml-c14n#Example-SETags)
>    <e6 xmlns="" xmlns:a="http://www.w3.org">
>      <e7 xmlns="http://www.ietf.org">
>         <e8 xmlns="" xmlns:a="http://www.w3.org">
>            <e9 xmlns="" xmlns:a="http://www.ietf.org"/>
>         </e8>
>      </e7>
>   </e6>
>
>    is canonicalized to
>
>    <e6 xmlns:a="http://www.w3.org">
>      <e7 xmlns="http://www.ietf.org">
>         <e8 xmlns="">
>            <e9 xmlns:a="http://www.ietf.org" attr="default"></e9>
>         </e8>
>      </e7>
>   </e6>
>
>Can you explain why there is no xmlns:a="http://www.w3.org" declaration
>in <e8>, please?

Sure; that document fragment is not an XPath node set, it
is a serialized XML document. When parsed, the XPath node
set will be:
  <e6 xmlns:a="http://www.w3.org">
    <e7 xmlns="http://www.ietf.org" xmlns:a="http://www.w3.org">
      <e8 xmlns:a="http://www.w3.org">
        <e9 xmlns:a="http://www.ietf.org"/>
      </e8>
    </e7>
  </e6>

That is to say, xmlns="" does not exist in the XPath node
set, and all the namespace attributes are propagated down.

So, the xmlns:a namespace node on e8 is suppressed because
it is present in the node set of the nearest ancestor of
e8, e7 which, during parsing, inherited it from e6.

Merlin

Received on Friday, 31 May 2002 13:54:10 UTC