[Bug 5251] [FO] Minimal match in starts-with(), ends-with()

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5251





------- Comment #4 from mike@saxonica.com  2008-01-18 09:56 -------
OK, I'll try again.

The original error is in starts-with() and ends-with(), so let's leave
substring-before() and substring-after() alone. The proposed change then
becomes:

1. In 7.5, delete the paragraph starting "In the definitions below, we say that
$arg1 contains $arg2 at positions m through n ..." because the paragraph is
defining terminology that is never used.

2. In contains():

2a) replace the Summary with: 

"Summary: Returns an xs:boolean indicating whether or not the value of $arg1
contains the value of $arg2 (at the beginning, at the end, or anywhere within).

Let $coll be $collation if specified, or the default collation otherwise. The
result of the function is the value of the following expression:

some $M in 1 to string-length($arg1), $N in 0 to string-length($arg1) satisfies
(compare(substring($arg1, $M, $N), $arg2, $coll) eq 0)

2b) delete the note referring to "Minimal match"

3. In starts-with():

3a) replace the Summary with: 

"Summary: Returns an xs:boolean indicating whether or not the value of $arg1
has the value of $arg2 as a leading substring.

Let $coll be $collation if specified, or the default collation otherwise. The
result of the function is the value of the following expression:

some $N in 0 to string-length($arg1) satisfies
(compare(substring($arg1, 1, $N), $arg2, $coll) eq 0)

3b) delete the note referring to "Minimal match"

3c) add the example

fn:starts-with ( "-abcdefghi", "-abc", "CollationA") returns true.

[Under the current rules requiring a minimal match, this one returns false)

4. In ends-with():

4a) replace the Summary with: 

"Summary: Returns an xs:boolean indicating whether or not the value of $arg1
has the value of $arg2 as a trailing substring.

Let $coll be $collation if specified, or the default collation otherwise. The
result of the function is is the value of the following expression:

some $N in 1 to string-length($arg1)+1 satisfies
(compare(substring($arg1, $N), $arg2, $coll) eq 0)

4b) delete the note referring to "Minimal match"

4c) add the example

fn:ends-with ( "abcdefghi-", "ghi-", "CollationA") returns true.

[Under the current rules requiring a minimal match, this one returns false)

Received on Friday, 18 January 2008 09:56:26 UTC