Re: XInclude 1.1 issue?

On 2015-02-24 10:11, Norman Walsh wrote:
> After my discussion of XInclude 1.1 at XML Prague, Eric van der Vlist
> asked what the post-XInclude infoset is for this element:
>
>    <xi:include xmlns:my="MYNAMESPACE"
>                href="mydoc.xml" fragid="element(foo)"
>                my:root="true"/>
>
> when mydoc.xml is:
>
> <doc xmlns:my="YOURNAMESPACE">
>    <my:note xml:id="foo">
>      <my:x/>
>    </my:note>
> </doc>
>

Regarding the example in the comment above (and at [0]), the
resulting infoset is clearly:

<{YOURNAMESPACE}:note xml:id="foo" {MYNAMESPACE}:root="true">
     <{YOURNAMESPACE}:x/>
</{YOURNAMESPACE}:note>

The only complication comes when trying to serialize this infoset.

(Note also the discussion in the Infoset spec about "Synthetic
Infosets" [1] and also the comments in XInclude's section on
Namespace Fixup [2].  See also the analogous discussion of
adding namespace declarations in the XSLT Recommendation [3].)

When serializing this infoset, the namespace prefixes emitted by
the XInclude implementation are implementation dependent.  See the
fourth paragraph under section 4.7 "Creating the Result Infoset"
at [4] where it says:

  Some processors may not be able to represent an element's
  in-scope namespaces property if it does not include bindings
  for all the prefixes bound in its parent's in-scope namespaces.
  Such processors may therefore include additional namespace
  bindings inherited from the include parent in the in-scope
  namespaces of the included items.

While neither the above paragraph nor the Namespace Fixup
section make an explicit reference to the case where prefixes
may need to be modified to avoid emitting namespace declarations
with the same prefix and different namespace names, that behavior
is already implied by the existing wording of the spec.

For example, one reasonable serialization of the infoset
resulting from the example in question might be:

<my:note xml:id="foo" my2:root="true"
          xmlns:my="YOURNAMESPACE" xmlns:my2="MYNAMESPACE">
   <my:x/>
</my:note>

paul

Paul Grosso for the XML Core WG

[0] 
http://lists.w3.org/Archives/Public/www-xml-xinclude-comments/2015Feb/0000
[1] http://www.w3.org/TR/2004/REC-xml-infoset-20040204/#intro.synthetic
[2] http://www.w3.org/TR/2014/WD-xinclude-11-20141216/#namespaces
[3] http://www.w3.org/TR/xslt#section-XML-Output-Method
[4] http://www.w3.org/TR/2014/WD-xinclude-11-20141216/#creating-result

Received on Wednesday, 4 March 2015 17:00:43 UTC