W3C home > Mailing lists > Public > public-qt-comments@w3.org > August 2002

XPath 2.0 Functions xf:substring-before and xf:substring-after

From: Ken Aldous <k.aldous@irl.cri.nz>
Date: Sun, 25 Aug 2002 22:00:18 -0400 (EDT)
Message-ID: <000801c24ca4$299b5b30$e9a041a1@kja>
To: <public-qt-comments@w3.org>
Hi

There is an issue with both of these functions that you may find worth considering.
Function substring-before (http://www.w3.org/TR/xquery-operators/#func-substring-before)
has the signatures:

xf:substring-before(string? $operand1, string? $operand2) => string? 
      xf:substring-before( string?  $operand1, 
      string?  $operand2, 
      anyURI  $collationLiteral) => string? 


Paragraph 3 of the description of the function states: 
...
If the value of $operand1 does not contain a string that is equal to the value of $operand2, then the 
function returns the zero-length string.
...

The issue is that, if the value of $operand1 is equal to the value of $operand2 (in which case 
the value of $operand1 certainly contains a string that is equal to the value of $operand2), 
then the function also returns a zero-length string. This is precisely what one would expect from 
the first paragraph of the description. So the function returns the same value when the two strings 
defined by the arguments are identical, and when they are entirely different.

One way to resolve this would be to distinguish between an empty or null string, and what 
might be called an "undefined string". The undefined string could then be returned by the function 
when the condition of paragraph 3 is satisfied ($operand1 does not contain a string that is
equal to the value of $operand2). This implies that the string domain would need to be extended 
to include this additional member, which then raises the unfortunate logical problem that the 
extended domain includes a member that does not belong to it ...

Best regards,
Ken Aldous.

--
Ken Aldous
Advanced Manufacturing
Industrial Research Limited
5 Sheffield Crescent
PO Box 20 028, Bishopdale
Christchurch
New Zealand
http://www.irl.cri.nz/

Ph:  +64 3 358 6818
Fax: +64 3 358 9506
k.aldous@irl.cri.nz
Received on Monday, 26 August 2002 03:46:28 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:43 UTC