xsl-list
[Top] [All Lists]

RE: [xsl] Re: What is $p in the definition of fn:subsequence ?

2008-07-05 06:20:13

  The spec doesn't specify the desired behavior if $length is <=  0.

Should the function return the empty sequence, a reversed 
subsequence (if $length is < 0) or should an error be raised? 
The same question goes for fn:substring().


I think these questions are answered by the equivalences given in the
(corrected) spec.

subsequence((1 to 10), 5, -3)

is equivalent to

(1 to 10)[5 le position() and position() lt 5 - 3]

which is an empty sequence.

The same applies to substring().

(Note, in case you are wondering why it is this way: subsequence was
deliberately designed to imitate substring(), and substring() was designed
on the 1.0 design principle of "no runtime errors except as a last resort")

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>