W3C home > Mailing lists > Public > public-qt-comments@w3.org > March 2004

[F+O] Type conversion in concat()

From: Michael Kay <mhk@mhk.me.uk>
Date: Wed, 3 Mar 2004 11:52:31 -0000
To: <public-qt-comments@w3.org>
Message-Id: <20040303115236.3852FA1276@frink.w3.org>
I have been testing the example stylesheets in my XSLT Programmer's
Reference under XSLT 2.0. Three or four of the examples (so far) have failed
with the same error: concat() in XPath 2.0 requires the arguments to be
supplied as strings. The most common examples are things like:


<title><xsl:value-of select='concat("Chapter ", position())'/></title>


It doesn't fail under backwards compatibility mode, of course. But that's
not good enough, we want to encourage users to run in pure 2.0 mode whenever


It doesn't seem reasonable here to ask users to write string(position()).
How can we justify asking them to make such changes - where are the


It's not required in XQuery, whose equivalent construct is:


<title>Chapter {position()}</title>


If this can implicitly cast to string, why can't concat()?


Java has a general policy of strict typing, but it makes an exception for
the string concatenation operator, which casts its operands implicitly to
strings. In XPath, concat() is already special-cased by allowing a variable
number of arguments. 


I believe we should change the signature of concat() so its arguments are
defined as anyAtomicType, and are implicitly cast to strings.


Michael Kay 
Received on Wednesday, 3 March 2004 06:52:36 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:18 UTC