- From: Mark D. Anderson <mda@discerning.com>
- Date: Sun, 15 Aug 2004 20:11:22 -0700
- To: public-qt-comments@w3.org
Two functions that I'd like to see added to xquery operators are: fn:match($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:string* fn:match($input as xs:string?, $pattern as xs:string) as xs:string* The function fn:match supports capturing parentheses: fn:match("alpha/beta/gamma", "^(\w*).*(\w*)$") returns ("alpha", "gamma") It the entire pattern does not match, then it returns the empty sequence. fn:apply($funcname as xs:QName, $args as xs:anyType*) as xs:anyType* The function fn:apply allows calling a function whose name may not be known statically, for example based on input. let $f1 := 'fn:sum'; let $call := <fn:sum><arg1>1</arg1><arg2>2</arg2></fn:sum> fn:apply($f1, (1, 2)) fn:apply(fn:name($f1), $call/text()) The function fn:apply does not allow for arguments which are themselves sequences, since nested sequences are not allowed in XQuery. An alternative would be fn:call with versions for any arity: fn:call($funcname as xs:QName) as xs:anyType* fn:call($funcname as xs:QName, $arg1 as xs:anyType*) as xs:anyType* fn:call($funcname as xs:QName, $arg1 as xs:anyType*, $arg2 as xs:anyType*) as xs:anyType* .... -mda
Received on Monday, 16 August 2004 03:12:23 UTC