Thats what I thought but thanks for the confirmation.
Q2: Is there a dynamic way to create an attribute or element of a given type ?
I cant think of any unless there is a loaded schema ... It might be
interesting to have a schema just for this purpose so you could create elements
say that auto-convert to the right type.
But I think you'd have to have a representative value ... like
typeswitch( validate element { $typename } { "1" }/node() )
But now were getting really obtuse. I think I'll stick to QName comparisons ...
From: [email protected] [mailto:[email protected]] On Behalf Of
Michael Kay
Sent: Friday, February 10, 2012 10:20 AM
To: [email protected]
Subject: Re: [xquery-talk] Getting type out of QName
Types aren't first-class objects in the XQuery data model. There are therefore
no expressions that return types as their result, or that operate on types
supplied dynamically at run-time.
Michael Kay
Saxonica
On 10/02/2012 15:07, David Lee wrote:
Is there a way to coerce/convert a QName into its representative type ?
Example: suppose I have
let $name := xs:QName( "xs:int" )
I can do
if( type eq xs:QName("xs:int") ) ...
But I cant do
typeswitch( $name (: how to cast to type ? :) )
case $i as xs:int ...
Any suggestions ? Is there some function or expression I'm missing which can
convert a QName into the type ?
----------------------------------------
David A. Lee
[email protected]<mailto:[email protected]>
http://www.xmlsh.org
_______________________________________________
[email protected]<mailto:[email protected]>
http://x-query.com/mailman/listinfo/talk
_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk