W3C home > Mailing lists > Public > www-ql@w3.org > January to March 2004

semantics of substring()

From: Howard Katz <howardk@fatdog.com>
Date: Thu, 11 Mar 2004 17:28:09 -0800
To: <www-ql@w3.org>
Message-ID: <IKEOLCDFPBBPPAHGNKKOAEMMEHAA.howardk@fatdog.com>

I don't understand one of the examples given for fn:substring() in the F and
O documentation [7.4.3]. The description of the function's behaviour says,
"If $startingLoc is zero or negative, the substring includes characters from
the beginning of the $sourceString." I take this to mean that

    substring( "12345", 0, 3 )

is equivalent to

    substring( "12345", 1, 3 )

which I understand evaluates to "123".

The example shown in the documentation however returns "12", and Saxon
echoes this. What am I misunderstanding?

TIA,
Howard
Received on Thursday, 11 March 2004 20:27:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 22 July 2006 00:10:19 GMT