functions in XQuery and XPath Data Model 3.0Michael Kay mike at saxonica.com
Sat Feb 25 10:04:56 PST 2012
On 25/02/2012 12:14, James Fuller wrote: > as http://www.w3.org/TR/xpath-datamodel-30/#other-items states the > xpath data model has matured and needs to add 'other types' ... which > have no xml serializations > > following on from this statement, I am wondering if the XQuery WG has > considered what could be returned in the following scenario: > > let $a := fn:position#0 > return > fn:string($a) Actually fn:position#0 isn't allowed - we don't allow function items to be formed from functions that access the dynamic context, because there's too much scope for confusion about which dynamic context is used. But if you substituted, say, root#1, we allow you to get the name of the function using function-name(root#1) and to get its arity using function-arity(root#1). That seems better to me that doing it by casting, which seems to rely on the purely accidental fact that all the properties of a function have distinct types. Michael Kay Saxonica > > it maybe nice to return the name of the function "fn:position" as a > string ... conversely, > > let $a := fn:position#0 > return > fn:QName($a) > > would return the qname of the function. > > its probably a stretch to extend this to function arity eg. > > let $a := fn:position#0 > return > xs:integer($a) > > which would return a value of 0. > > it may also be useful to expand the description of what functions are > in the data model via fully describing the term 'callable' here > http://www.w3.org/TR/xpath-datamodel-30/#other-items. > > James Fuller > _______________________________________________ > http://x-query.com/mailman/listinfo/talk > http://x-query.com/mailman/listinfo/talk >
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format