RE: semantics of substring()

Howard:
I believe your interpretation is correct.

In future please send comments on XML Query and XPath 2.0 to 
public-qt-comemnts@w3.org.

All the best, Ashok

-----Original Message-----
From: www-ql-request@w3.org [mailto:www-ql-request@w3.org] On Behalf Of
Howard Katz
Sent: Friday, March 12, 2004 8:17 AM
To: Marcus Boerger
Cc: www-ql@w3.org
Subject: RE: semantics of substring()


I'm presuming by Michael's prior example that substring( "12345", -1, 3)
is
thus to be interpreted as the 3 characters starting from the -1'th
position
in the string. Which gives "1".

Grappling with the concept of imaginary numbers in university helped
convince me that I didn't have a vocation in the hard sciences.
Hopefully
the rather novel concept of imaginary character positions in strings
won't
similarly drive me out of computing! :-)

Howard

> -----Original Message-----
> From: Marcus Boerger [mailto:mail@marcus-boerger.de]
> Sent: Friday, March 12, 2004 1:48 AM
> To: Howard Katz
> Cc: www-ql@w3.org
> Subject: Re: semantics of substring()
>
>
> Hello Howard,
>
> Friday, March 12, 2004, 2:28:09 AM, you wrote:
>
>
> > 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?
>
> Wouldn't startlogic mean
>     substring("12345", -1, 3) = "123" or "12"
> the problem i have here is how to compute the length. starting with
the
> nonexisting char at -1 or with the first existing one?
>
> --
> Best regards,
>  Marcus                            mailto:mail@marcus-boerger.de
>

Received on Friday, 12 March 2004 11:20:27 UTC