Re: Serialization (sometimes) needs to include type information

Hello,

     In [1], you submitted the following comment on the Last Call Working 
Draft of XSLT 2.0 and XQuery 1.0 Serialization:

<<
Consider the following schema fragment:

<xs:element name="A">
    <xs:complexType>
       <xs:sequence>
          <xs:element name="C" type="myns:Type1"/>
       </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:element name="B">
    <xs:complexType>
       <xs:sequence>
          <xs:element name="C" type="myns:Type2"/>
       </xs:sequence>
    </xs:complexType>
</xs:element>

Now if we consider a document (or any other data source) containing
both A and B elements, the following query

<result>
{
    for $x in doc("myDocument")//C
    return $x
}
</result>

returns a result that cannot be strongly typed without losing type
information by any valid schema, as the schema spec forbids elements
with the same name and a different type in the same content model.

It seems to me that the only way of retaining type information would
be to annotate produced C elements with xsi:type. This could be a
serialization parameter, similar to the
cdata-section-elements. However, this would raise another issue, as
anonymous type names would then be exposed, and would thus require to
be handled in a consistent way by different XQuery and XML Schema
processors.

This issue is important, especially for tools that perform distributed
XQuery processing, and that need to retain consistent type information
when moving XML data from one processing node to another.
>>

     Thank you for this comment.  The XSL and XML Query Working Groups 
discussed your comment and several related comments.  There was general 
agreement that there is some need for a mechanism that preserves most or 
all of the properties of the items in the sequence that is being 
serialized.

     However, the working groups decided that precisely defining all of 
the requirements for such a mechanism at this stage would be difficult, 
and would likely lead to a solution that would not satisfy real user 
requirements.  Therefore, the working groups decided to consider such a 
feature for a future revision of the recommendations, and close this 
comment without any changes to the specifications.

     May I ask you to confirm that this response is acceptable to you?

Thanks,

Henry [On behalf of the XSL and XML Query Working Groups]
[1] 
http://lists.w3.org/Archives/Public/public-qt-comments/2004Feb/0188.html
------------------------------------------------------------------
Henry Zongaro      Xalan development
IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com

Received on Tuesday, 13 July 2004 10:13:27 UTC