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

RE: appeal for fn:match and fn:apply

From: Ashok Malhotra <ashok.malhotra@oracle.com>
Date: Fri, 27 Aug 2004 17:19:21 -0700
To: "Mark D. Anderson" <mda@discerning.com>, public-qt-comments@w3.org
Message-ID: <20040827171921271.00000002848@amalhotr-pc>

Mark:
Thank you for your comments.
The joint WGs discussed your request on 8/26/2004 and decided not to
add the functionality in this version.  These advanced functions have
been suggested before and the requests have been turned down for the
same reason.

I hope you find this resolution satasfactory.

All the best, Ashok


-----Original Message-----
From: public-qt-comments-request@w3.org
[mailto:public-qt-comments-request@w3.org]On Behalf Of Mark D. Anderson
Sent: Sunday, August 15, 2004 8:11 PM
To: public-qt-comments@w3.org
Subject: appeal for fn:match and fn:apply



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 Saturday, 28 August 2004 00:20:10 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:13:55 UTC