[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Re: What is $p in the definition of fn:subsequence

Subject: RE: Re: What is $p in the definition of fn:subsequence ?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 5 Jul 2008 14:19:45 +0100
RE:  Re: What is $p in the definition of fn:subsequence
>   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/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.