- From: Ashok Malhotra <ashokma@microsoft.com>
- Date: Fri, 16 Jan 2004 07:23:19 -0800
- To: "Kay, Michael" <Michael.Kay@softwareag.com>, "Noe Michejda" <noe_michejda@7thportal.pl>, <public-qt-comments@w3.org>
Note that one of the examples in 7.5.5 says: fn:substring-after("Who there?","") returns "Who there?". This does assume that each string contains the zero-length string at the start. OTOH, the example fn:substring-before("Baloney!","") returns "Baloney!". Seems to assume that every string contains the zero-length string at the end. We need to decide consciously whether every string implicitly contains a zero-length string at the start, at the end or both. All the best, Ashok -----Original Message----- From: public-qt-comments-request@w3.org [mailto:public-qt-comments-request@w3.org] On Behalf Of Kay, Michael Sent: Friday, January 16, 2004 7:07 AM To: Noe Michejda; public-qt-comments@w3.org Subject: 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:23:26 UTC