Bug / Issue Tracking Service
Bugzilla – Bug 4974
[FO] Clarify error condition in fn:normalize-space()
Last modified: 2007-11-16 09:34:40 UTC
This is an editorial suggestion. The description of fn:normalize-space() contains the following sentence: "If no argument is supplied or if the argument is the context item and the context item is undefined an error is raised." This could be misinterpreted as "If no argument is supplied, or (...), then an error is raised." A less ambiguous way to state this rule is as follows: "If the implicit or explicit argument is the context item, and the context item is undefined, an error is raised." Regards, Don Chamberlin
The proposed revision isn't quite right, because the implicit argument is not "." but "string(.)". (I'm not really sure why: but that's the way it is, and they aren't quite the same.) I don't think we need to say that "if the argument is the context item and the context item is undefined then XPDY0002 is raised". This means you have written normalize-space(.), and in this case normalize-space() gets no say in the matter because the error has already occurred while evaluating the argument, ".", under XPath section 3.1.4. So (avoiding the temptation to make more extensive changes) I think we should change the relevant paragraph to read: <new> If no argument is supplied, then $arg defaults to the string value (calculated using fn:string()) of the context item (.). If no argument is supplied and the context item is undefined then an error is raised: [err:XPDY0002]XP. </new>
The WG agreed on 25 Sep 2007 to make the change proposed in comment #1
The erratum will be published as E14