W3C home > Mailing lists > Public > public-qt-comments@w3.org > August 2004

appeal for fn:match and fn:apply

From: Mark D. Anderson <mda@discerning.com>
Date: Sun, 15 Aug 2004 20:11:22 -0700
To: public-qt-comments@w3.org
Message-Id: <1092625882.6413.202386411@webmail.messagingengine.com>

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",

It the entire pattern does not match, then it returns the empty

   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*

Received on Monday, 16 August 2004 03:12:23 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:20 UTC