F&O: parameter occurences

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 'exacly 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) )

Also accesors uses 'exacly one', but maybe it is intended:
 fn:node-kind($srcval as node) as xs:string
 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?


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)

Best regards
Noe Michejda
7th Portal S.C.

Received on Tuesday, 24 June 2003 08:41:30 UTC