RE: Resolving ID/IDREF conflicts

Response below.

> -----Original Message-----
> From: Roger L. Costello [mailto:costello@mitre.org]
> Sent: Saturday, March 30, 2002 11:04 AM
> To: www-xml-xinclude-comments@w3.org
> Cc: costello@mitre.org
> Subject: Resolving ID/IDREF conflicts
> 
> I am trying real hard to understand the proposed method for resolving
> ID and IDREF conflicts [section 4.5.3].  Alas, after many, many
rereads
> I do not understand.  I understand best when I see a concrete example,
> so please allow me to consider this example of a <Library> containing
a
> <BookCatalogue> section and a <GuestAuthors> section:
> 
> <?xml version="1.0"?>
> <Library>
>     <BookCatalogue>
>         <Book isbn="_94303-12021-43892">
>                 <Title>My Life and Times</Title>
>                 <Author>Paul McCartney</Author>
>                 <Date>1998</Date>
>                 <Publisher>McMillin Publishing</Publisher>
>         </Book>
>         <Book isbn="_0-440-34319-4">
>                 <Title>Illusions The Adventures of a Reluctant
>                        Messiah</Title>
>                 <Author>Richard Bach</Author>
>                 <Date>1977</Date>
>                 <Publisher>Dell Publishing Co.</Publisher>
>         </Book>
>         <Book isbn="_0-06-064831-7">
>                 <Title>The First and Last Freedom</Title>
>                 <Author>J. Krishnamurti</Author>
>                 <Date>1954</Date>
>                 <Publisher>Harper &amp; Row</Publisher>
>         </Book>
>     </BookCatalogue>
>     <GuestAuthors>
>         <GuestAuthor>
>             <Name>Richard Bach</Name>
>             <BookForSigning isbn_ref="_0-440-34319-4">
>                 <Title>Illusions The Adventures of a Reluctant
>                        Messiah</Title>
>             </BookForSigning>
>         </GuestAuthor>
>     </GuestAuthors>
> </Library>
> 
> The isbn_ref attribute on the <BookForSigning> element is of type
> IDREF.  Its purpose is to point to the corresponding <Book> in the
> <BookCatalogue> section.  Each <Book> has an ID attribute, isbn.
> 
> First Question:
> 
> Suppose that the library has another document that includes the
> <BookForSigning> element.  Here's the include element:
> 
> <LibraryYearlySummary>
>    <xi:include
>          href="Library.xml#xpointer(/Library/.../BookForSigning)"/>
> </LibraryYearlySummary>
> 
> What would the resulting document look like?  Is the isbnRef
> attribute's
> value left dangling in the result document?

Following the last paragraph in 4.5.3, we see that the [references]
property has no value.  The [attribute type] property remains as IDREF.
So yes, the attribute's value is left dangling.

> Second Question:
> 
> Suppose that instead of including the <BookForSigning> element I
> include
> one of the <Book> elements.  Note that each <Book> element has an ID
> attribute, isbn.  Suppose that the including document already has an
> element with the same ID value:
> 
> <MyBookCatalogue>
>     <foo id="_94303-12021-43892"/>
>     <xi:include
>         href="Library.xml#xpointer(/Library/.../Book[1])"/>
> </MyBookCatalogue>
> 
> What will the resulting document look like?

The last paragraph in 4.5.3 says that the first element is chosen for
the [references] property.  The resulting document would look like:

<MyBookCatalogue>
  <foo id="_94303-12021-43892"/>
  <Book isbn="_94303-12021-43892">
    <Title>My Life and Times</Title>
    <Author>Paul McCartney</Author>
    <Date>1998</Date>
    <Publisher>McMillin Publishing</Publisher>
  </Book>
</MyBookCatalogue>

There will be two attributes of type ID.  Any [references] to these ids
will point to the first one.  In this case, there are no such
references.

I think the crux of your question is whether XInclude guarantees that
inclusion of valid documents results in a valid document.  The answer of
course must be no, and IDs are no exception to this rule.

> /Roger

Received on Saturday, 6 April 2002 11:29:42 UTC