Re: c14n/exc-c14n interop samples

merlin <[email protected]> Fri, 31 May 2002 18:52:57 +0100
Newsgroups gmane.ietf.xmldsig
Message-ID <[email protected]>

Hi Aleksey;

r/[email protected]/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