Re: F&O: parameter occurrences

Noe:
Thank you for your comment: 
http://lists.w3.org/Archives/Public/public-qt-comments/2003Jun/0217.html

I'm sorry it has taken so long to respond to you 
but we have been working on the issues you raised and I believe you will
be happy
with the outcome.  Comments inline.

=====================  Original Message ================================

Most functions takes their first ('main') argument as 'zero-or-one' and
returning empty sequence,
when argument is empty. This is very useful when working with path and
optional elements/attributes.

But there are few functions which uses 'exactly one' indicator with no
clear
reason for me:

 fn:collection( $srcval as xs:string)  as node*
  (I think it should be xs:string* as in very similar fn:doc)

 fn:escape-uri( $uri-part as string, $escape-reserved as xs:boolean) as
xs:string
 fn:resolve-uri( $relative as xs:string, $base as anyURI) as xs:string
 fn:resolve-QName( $qname as xs:string, $element as element) as xs:QName
 fn:root($srcval as node) as  node
 fn:string-to-codepoints($srcval as xs:string) as xs:integer*

  (escape-uri and resolve-uri has typo: missing 'xs' prefix (should be
xs:string, xs:anyURI) )

[AM] All these functions now take xs:string?

Also accesors uses 'exacly one', but maybe it is intended:
 fn:node-kind($srcval as node) as xs:string
[AM} This function has been removed
 fn:node-name($srcval as node) as xs:QName?
  (vs fn:local-name($s as node?), fn:name($s as node?),
fn:namespace-uri($s
as node?)  )
 fn:base-uri($srcval as node) as xs:string?
 fn:document-uri($srcval as node) as xs:string?

[AM] These still take node() and not node()?.  But you do not feel very
strongly about this.


fn:lang($testlang as xs:string) as xs:boolean
spec states:

"The relevant xml:lang attribute is determined by the value of the XPath
expression:

(ancestor-or-self::*/@xml:lang)[last()]

If this expression returns an empty sequence, the function returns
false."

I think it would be useful to allow 'xs:string?':
for empty argument it will return true when above expression returns ()
(i.e. when there is no language specified)

[AM] This is an interesting suggestion.  We can consider it but
fn:lang()  
is an XPath 1.0 function and there is reluctance to change it
significantly.
There is, however, some ongoing discussion on fn:lang() and we can
factor in 
your request.  

Best regards


All the best, Ashok

Received on Thursday, 9 October 2003 12:26:20 UTC