- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Mon, 19 Aug 2002 21:32:41 +0100
- To: public-qt-comments@w3.org
Hi, In Section 5 of the Data Model WD, it says: The accessor dm:string-value can be used to recover a lexical representation of the atomic value. The details of converting an atomic value to its string representation are described in the "Casting Functions" section of [XQuery 1.0 and XPath 2.0 Functions and Operators]. In particular if the atomic value's type is primitive, dm:string-value returns the atomic value's canonical lexical representation for that primitive type as specified in [XMLSchema Part 2]. If the atomic value's type is derived, the lexical representation depends on whether a value is supplied for the type's pattern facet: If no such value is supplied dm:string-value returns the atomic value's canonical lexical representation for the base type (which is a primitive type). Otherwise dm:string-value returns a lexical representation that matches the value specified for the pattern facet. (This case includes xs:integers.) There are several things that confuse me here, specifically in the second half of this paragraph. I can't find the place in the F&O WD where it talks about casting from a derived type to a string (e.g. from an integer to a string). The F&O WD talks about casting from a derived type to *its* primitive type in Section 16.2 and about casting from a primitive type to a string in Section 16.6, but there's nothing that I can see about casting directly from a derived type to a string. There is a hint that you might be able to pipeline the two casts together in one step, so: cast as xs:string(xs:integer('2')) would be the same as: cast as xs:string( cast as xs:decimal(xs:integer('2'))) but if you did that then you'd lose information about the fact that integers can't have any significant decimal places, and you'd get the string "2.0" rather than "2". The only mention of the pattern facet that I can find in the "Casting Functions" section of the F&O WD is where it talks about casting between two types that are both derived from the same primitive type, which doesn't apply in this case. Perhaps when this part of the Data Model WD says: The details of converting an atomic value to its string representation are described in the "Casting Functions" section of [XQuery 1.0 and XPath 2.0 Functions and Operators]. In particular... It means: The normal method of converting an atomic value to its string representation is described in the "Casting Functions" section of [XQuery 1.0 and XPath 2.0 Functions and Operators]. In this case, though... Or perhaps the F&O WD hasn't yet been updated with the decisions described in this section of the Data Model WD. BTW, I should note that in the XML Schema for XML Schema, xs:integer is defined as: <xs:simpleType name="integer" id="integer"> <xs:annotation> <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#integer"/> </xs:annotation> <xs:restriction base="xs:decimal"> <xs:fractionDigits value="0" fixed="true" id="integer.fractionDigits"/> </xs:restriction> </xs:simpleType> The pattern facet isn't set in this definition, nor mentioned in the prose description, although I agree that it should be, since the valid lexical representations for integers do not include the canonical lexical representations for decimals. Perhaps you can suggest this as an erratum. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Monday, 19 August 2002 16:32:43 UTC