RE: MS-FO-LC1-078: Return types of name functions

> Michael:
> My recollection is that we took a decision some time ago to 
> return the base Schema types and not more specific derived 
> types because this helped function composability.  We do the 
> same thing in 14.1.2, fn:local-name.  fn:item-at and 
> fn-index-of return xs:integer and not the more specific xs:int. 

I think this decision made sense for numeric return values: for example,
get-day-from-date returns an integer in the range 1 to 31, which does not
map exactly to any of the built-in subtypes of xs:integer, and is a subrange
of several of them.

I don't think it makes so much sense in this case. The range of values of
the result of local-name() is precisely the range of values permitted by
xs:NCName, and there is also a match between the intended semantics of this
type and the actual semantics of the return value. Function composability
would be improved by returning xs:NCName, because the return value could
still be used anywhere an xs:string is required, and could additionally be
used in places that expect an xs:NCName.

The only downside is that this requires xs:NCName to be present in the
static context. Currently XSLT "basic" does not include this type in the
static context for XPath expressions.

Michael Kay

> 
> 
> All the best, Ashok
> 
> > -----Original Message-----
> > From: public-qt-comments-request@w3.org [mailto:public-qt-comments- 
> > request@w3.org] On Behalf Of Michael Rys
> > Sent: Tuesday, July 01, 2003 12:36 AM
> > To: public-qt-comments@w3.org
> > Subject: MS-FO-LC1-078: Return types of name functions
> > 
> > 
> > Class: Technical
> > 
> > Sections 14.1.1ff: Why do we return xs:string instead of xs:NCName?
> > 
> 
> 

Received on Monday, 11 August 2003 06:12:59 UTC