FW: static typing and computed elements

Hi,

//element { if $language = "french" then "titre" else "title" } { "LoTR" }
// has type
//element * { xs:string }

I was woundering if the type was element titre|title {xs:string}.  Thanks!

Martin Tapp

-----Original Message-----
From: Jerome Simeon [mailto:simeon@research.bell-labs.com]
Sent: Thursday, January 17, 2002 10:18 AM
To: hme@informatik.uni-rostock.de
Cc: www-ql@w3.org
Subject: Re: static typing and computed elements


Holger,

The XQuery static typing handles dynamic element names fine. The trick
is to realize that wildcard names are part of the type system and can be
used to type such an operation.

For instance:

element title { "Lord of the Rings" }
 has type
element title { xs:string }

and:

element { if $language = "french" then "titre" else "title" } { "LoTR" }
 has type
element * { xs:string }

where the * is a wildcard that stands for all possible QNames.

So you can statically type this expression without problem, you just get
a less precise type.

You can see more details about the typing for element constructors in
section 4.4 of the XQuery formal semantics (June working draft).

- Jerome

Received on Friday, 18 January 2002 15:53:46 UTC