RE: [F&O] 7.5.4 fn:substring-before

Thanks. Personal response:

XPath 1.0 compatibility is obviously important here. The XPath 1.0
specifications are rather terse on these matters, but the only way you
can interpret them consistently (and the way that implementors have
consistently interpreted them) is that all the string-matching functions
behave as if every string (including the zero-length string) contains a
zero-length string right at the start. This means that the example is
wrong, and fn:substring-before("Baloney!","") should return "".

Michael Kay

> -----Original Message-----
> From: public-qt-comments-request@w3.org 
> [mailto:public-qt-comments-request@w3.org] On Behalf Of Noe Michejda
> Sent: 15 January 2004 21:05
> To: public-qt-comments@w3.org
> Subject: [F&O] 7.5.4 fn:substring-before
> 
> 
> 
> F&O section 7.5.4 (definition of function fn:substring-before) states:
> 
> "If the value of $arg2 is the zero-length string, then the 
> function returns the zero-length string."
> 
> But later example is given:
> "fn:substring-before("Baloney!","") returns "Baloney!". "
> 
> Then 7.5.5 fn:substring-after states:
> 
> "If the value of $arg2 is the zero-length string, then the 
> function returns the value of $arg1."
> 
> I think error in definition of fn:substring-before, behavior 
> should be the same as in fn:substring-after. "If the value of 
> $arg2 is the zero-length string, then the function returns 
> the value of $arg1."
> 
> If definition is correct and example mistaken, I think it is 
> bad idea to return zero-length string in such case.
> 
> Best regards,
> Noe Michejda
> 7th Portal S.C.
> 
> 
> 

Received on Friday, 16 January 2004 10:06:54 UTC