[Bug 10261] [F&O] return value of fn:replace and fn:tokenize if $pattern does not match

http://www.w3.org/Bugs/Public/show_bug.cgi?id=10261





--- Comment #1 from Michael Kay <mike@saxonica.com>  2010-07-29 15:35:16 ---
Thanks for the comment.

Concerning fn:replace, the summary says: "The function returns the xs:string
that is obtained by replacing each non-overlapping substring of $input that
matches the given $pattern with an occurrence of the $replacement string."

Admittedly this relies on an understanding of the English phrase "replacing a
substring of a string", and in particular the implication that the rest of the
string (outside that substring) is left unchanged; but given that expansion, I
don't see how one can interpret this in any way other than meaning if there are
no matches, no replacements are made, and therefore the original string is
returned unchanged. (OK, perhaps it's also relying on the mathematician's
understanding of "each" as opposed to the everyday understanding.)

Similarly the summary of fn:tokenize is "This function breaks the $input string
into a sequence of strings, treating any substring that matches $pattern as a
separator. The separators themselves are not returned." 

Again this is informal language, but I think the only possible interpretation
is that if there are no matches then there are no separators and therefore the
result sequence contains a single string which is the same as the original.

My recommendation to the WG is to treat this as editorial, and to try and
improve the text for the next ("1.1") version by making the language a bit more
formal. In particular, I've been trying in 1.1 to ensure that the function
summaries contain no information that does not appear explicitly in the rules,
and these two functions don't satisfy that rule (in the 1.0/2.0 spec, very few
did).

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Thursday, 29 July 2010 15:35:20 UTC