[Bug 4273] [FS] data on element()

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4273





------- Comment #11 from tim@cbcl.co.uk  2007-10-22 11:57 -------
What follows is my arguement that data on xs:anyType = xs:anyAtomicType*

element(*, xs:anyType) is the most general type of an element.

For the type system to work, I argue that:

T <: xs:anyType
--------------------------------------------
data on T <: data on element(*, xs:anyType)

Let's break it down into 3 specific cases of T (covered in FS) which are
necessarily always subtypes of element(*, xs:anyType).  

1. simple type or complex types of simple content.

statEnv |-  ElementType type lookup TypeReference
statEnv |-  TypeReference expands to Type
statEnv  |-  Type <: (attribute*, Type1)      
statEnv  |-  Type1 <: xs:anyAtomicType*
----------------------------------------
statEnv |-  data on ElementType : Type1

So if the Type1 = xs:anyAtomicType*, we know that

data on element(*, xs:anyAtomicType*) = xs:anyAtomicType*

and therefore xs:anyAtomicType* must be a subtype of 'data on' applied to
element(a,  xs:anyType).

2.  complex type of mixed content

statEnv |-  ElementType type lookup of type TypeName
statEnv |-  TypeName of elem/type expands to expanded-QName     
statEnv.typeDefn(expanded-QName) =
  define type TypeName Derivation mixed { Type1 }
--------------------------------------------------------------
statEnv |-  data on ElementType : xs:untypedAtomic

We know that data on applied to such an element is xs:untypedAtomic.

3.  The data on filter is not defined on any element type whose type annotation
denotes a complex type of complex content and therefore applying data on to
such a node raises a static error.

So data on applied to element(*, xs:anyType) must be the union of data on
applied to elements defined in the above cases.  By my reckoning, that's
xs:anyAtomicType*.

I'm willing to proved wrong though.   If you have an example that you think
won't work, I'd be happy to give it a whirl.  I'm sure it would also be a
useful addition to XQTS.

Received on Monday, 22 October 2007 11:57:55 UTC