Lexical format of fractional seconds in xs:duration

For the record:

XSD 1.0 part 2 second edition specified the format of the seconds component of xs:duration as [0-9]+(\.[0-9]+)?, which requires a digit before and after the decimal point. This was introduced by erratum E2-23 to the first edition.

XSD 1.1 part 2 replaces the regular expression with BNF:

duSecondFrag ::= (unsignedNoDecimalPtNumeral | unsignedDecimalPtNumeral) 'S'
unsignedNoDecimalPtNumeral ::= digit+
unsignedDecimalPtNumeral ::= (unsignedNoDecimalPtNumeral '.' fracFrag?) | ('.' fracFrag)

Which allows the "." to appear at the start or end of the number.

I suspect this change was unintended; it does not appear to be warranted by anything in ISO 8601. Certainly ISO 8601:2004 explicitly requires a the decimal separator (if present) to be preceded and followed by a digit.

Received on Monday, 11 September 2023 08:43:11 UTC