[Bug 2944] [FO] 10.5 fn:years-from-duration etc have wrong argument types

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2944





------- Additional Comments From per@bothner.com  2006-02-27 18:07 -------
(In reply to comment #1)
> Durations in XML Schema 1.0 are 6-tuples, which would suggest that
> years-from-duration(P24M) (excuse the shorthand) should return zero; while in
> XML schema 1.1, durations are 2-tuples, which would suggest that the same
> function returns 2. 

I don't think that's a useful example.  It seems that:
  fn:years-from-duration(xs:duration(LEXVALUE))
should always return the same as
  fn:years-from-duration(xs:yearMonthDuration(LEXVALUE))
whenever xs:yearMonthDuration(LEXVALUE) is well-defined.

The tricky part is when you have a LEXVALUE with components such that it is
neither a yearMonthDuration or a dayTimeDuration.  But even here there it is
well-defined - using the existing definition:
  fn:XXX-from-duration($arg) "Returns an xs:integer[or xs:decimal] representing
the XXX component in the canonical lexical representation of the value of $arg."
That pushes the issue to the "canonical lexical representation" - but that does
appear to handle this case.
(It would probably be cleaner to define "canonical lexical representation" in
terms of fn:XXX-from-duration rather than vice versa, of course)

Received on Monday, 27 February 2006 18:06:26 UTC