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

RE: XPath 2.0 Functions xf:substring-before and xf:substring-aft er

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Mon, 26 Aug 2002 19:20:10 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E621060453DABE@daemsg02.software-ag.de>
To: Ken Aldous <k.aldous@irl.cri.nz>, public-qt-comments@w3.org
The specification of these functions is constrained by the requirement to
keep them backwards compatible with XPath 1.0. The problem you point out is
known, but it is easy to get around it by first calling xf:contains().
 
Michael Kay
Software AG

-----Original Message-----
From: Ken Aldous [mailto:k.aldous@irl.cri.nz] 
Sent: 26 August 2002 03:00
To: public-qt-comments@w3.org
Subject: XPath 2.0 Functions xf:substring-before and xf:substring-after


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
<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/ <http://www.irl.cri.nz/> 
 
Ph:  +64 3 358 6818
Fax: +64 3 358 9506
k.aldous@irl.cri.nz <mailto:k.aldous@irl.cri.nz> 
Received on Monday, 26 August 2002 13:20:22 UTC

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