- From: Kay, Michael <Michael.Kay@softwareag.com>
- Date: Mon, 9 Jun 2003 16:41:42 +0200
- To: xquery@attbi.com, public-qt-comments@w3.org
> Given two opaque expressions $x and $y, does XQuery have a convenient > expression that converts $x to the same (dynamic or static) > type as $y? No, I don't think it does. I think we should consider this when and if we provide instrospection (types as first class objects) in a future version of the language. Michael Kay > > I can write a gnarly (60+ lines, just to handle singletons) > typeswitch that > converts $x to the dynamic type of $y, provided I'm willing > to settle for the > built-in XQuery types only. I haven't found any way to > handle user-defined > types, or to convert $x to the static type of $y. > > Strangely, this operation does come up (at least for dynamic > types); for > example, the general comparison operators perform this conversion on > xdt:untypedAtomic values in some cases. > > Perhaps there should be a built-in function like > convert-to-same-type-as($exprToConvert as item*, $type as > item*) as item* ? > > Cheers, > > Michael Brundage > Writing as > Author, "XQuery: The XML Query Language" (Addison-Wesley, to > appear 2003) Co-author, "Professional XML Databases" (Wrox > Press, 2000) > > not as > Technical Lead > Common Query Runtime/XML Query Processing > WebData XML Team > Microsoft >
Received on Monday, 9 June 2003 10:41:47 UTC