[xquery-talk] fn:codepoints-to-string

Martin Probst martin at x-hive.com
Tue Oct 25 14:53:30 PDT 2005

I'm not completely sure if this is the right place to ask, but I think
there are quite a lot of people in the standards group that read this
fn:codepoints-to-string specifies (in here:
http://www.w3.org/TR/xpath-functions/#func-codepoints-to-string ):

> Summary: Creates an xs:string from a sequence of [The Unicode
> Standard] code points. Returns the zero-length string if $arg is the
> empty sequence. If any of the code points in $arg is not a legal XML
> character, an error is raised [err:FOCH0001].

The interesting part is the "not a legal XML character". What is a legal
XML character? The standard probably does not refer to characters in
QNames, but what then?

There is a test in XQTS that tests fn:codepoints-to-string(60), which
will give '<', and expects this to fail. But why? '<' is a completely
legal, sound character in element and attribute contents, except that
you have to escape it when serialising the document. The XPath/XQuery
datamodel does not work on serialised documents, and any XQuery/XPath
engine will escape the character for you when serialising your document.

Does anyone know what this sentence in the spec originally intended to
prohibit? If it actually wants to prohibit '<', '&' and friends, it
should be rewritten to actually say that, or even better just drop the
whole sentence, as it does not make any sense, at least to me.


More information about the talk mailing list