Casting to types derived from xs:NOTATION

Hi,

I have two questions regarding xs:NOTATION.

1. Does there exist a constructor my:notation(xdt:anyAtomicType) for
my:notation derived by restriction from xs:NOTATION?

From F&O 5.2 'Constructor Functions for User-Defined Types':

"For every globally-defined atomic type in the static context (See [XQuery 
1.0: An XML Query Language] that is derived by restriction from a 
primitive type, there is a constructor function [...] whose effect is to 
create a value of that type from the supplied argument"

However F&O 17.15 Casting to xs:NOTATION states:

"It is not possible to cast values of any other type to xs:NOTATION 
because the validity of an xs:NOTATION value is context dependent and 
cannot, in general, be determined."

This appears inconsistent since, according to F&O 5.1, constructors are 
equivalent to casting.

2.  If constructors for types derived from xs:NOTATION exist, how do 
they work?

According to F&O 17.5:

"Casting across the type hierarchy is logically equivalent to three 
separate steps performed in order. Errors can occur in either of the 
latter two steps.

* Cast the source value, up the hierarchy, to the primitive type of the 
source.
* Cast the value to the primitive type of the target type.
* Cast the value down to the target type. "

In the case of xs:NOTATION however: 

xs:string("http://example.com:jpeg") cast as my:notation

(where my:notation is derived by restriction from xs:NOTATION)

should be allowed (see XPath 2.0 Language 3.10.2 4.3), but the second step 
above would fail, since casting from xs:string to xs:NOTATION is not 
permitted.

Thanks for any clarifications,
Caroline

-- 
Caroline Rioux, Software Engineer           +44-1865-203192
DecisionSoft Limited                        http://www.decisionsoft.com
XML Development and Services

Received on Tuesday, 12 August 2003 12:25:36 UTC