- From: Michael Kay <mhk@mhk.me.uk>
- Date: Tue, 10 Feb 2004 22:56:16 -0000
- To: "'Jonathan Robie'" <jonathan.robie@datadirect.com>, "'XML Query Comments'" <public-qt-comments@w3.org>
> > We currently have a function called fn:string() and a > constructor called xs:string(), which both create strings. There > is some justification for having both. xs:string is a constructor > for a built-in type, and all built-in types have associated > constructors. fn:string() is a widely used function in XPath > 1.0, so it is difficult to remove it at this point. > > But they are defined differently. fn:string() uses the > string value, whereas xs:string() atomizes the node and casts > the result to a string. These two definitions give subtly > different results. Could one be made a synonym for the other, > to avoid confusion? > What would you propose as the common definition? I think this depends on the resolution of the data model issue whereby the string-value of a node is currently underspecified, for example it isn't clear whether the string value of a decimal attribute containing "4.00" is "4.00" or "4". Assuming it's "4.00", then the fn:string() function is currently the only way of getting the string value of the node; but casting to a string should definitely give the canonical representation of the number. Michael Kay
Received on Tuesday, 10 February 2004 18:29:56 UTC