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

> Basically I have feeling, that both fn:substring-before and
> fn:substring-after
> should return same value when called with zero-length string
> - either zero-length string or unchanged first argument.

If you consider fn:substring-before('xxxxxxx','x') and
fn:substring-after('xxxxxxx','x') you wouldn't expect them to
return the same.
(Of course, otherwise we wouldn't need two different functions)

> Anyway I don't think, that logic of having 'virtual' empty string at
> beginning or end of every string should be determinant here.

I think it is important, and even more, it is logical and conistent.

Let fn:substring-after($a,$b) return $c
Let fn:contains($b,$bb) return true
Then I do expect that fn:contains(fn:substring-after($a,$bb), $c) is true.
Don't you?

In other words: if $c follows $b and $bb is in $b then $c follows $bb.
So we would have to argue whether fn:contains($a,'') should return true.
I think it should.

Best regards,
Oliver
(not a WG member)

Received on Wednesday, 25 February 2004 02:58:35 UTC