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

Re: One-based indexes in XPath

Subject: Re: One-based indexes in XPath
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 20 May 2008 19:52:41 +0100
Re:  One-based indexes in XPath
2008/5/20 Colin Adams <colinpauladams@xxxxxxxxxxxxxx>:
>>   1  2  3  4  5  6  7  8  9 10
>>   11 12 13 14 15 16 17 18 19 20
>>   21 22 23 24 25 26 27 28 29 30
>>
>>  Now ask the kids what is more difficult to learn, English or Arithmetic?
>>  (when the decade changes on the same row).
>
> The decade does not change on the same row.
> Each row is a single decade.

Isn't the point that the "twenties" start on the row above the rest;
each row spans 2 decades (the "nineties" started when 1989 became
1990, not 91)

The ultimate example of zero/one based confusion is in Java when
creating a date - days are 1 based, but months are zero based, so

new GregorianCalendar(2008, 5, 20)

returns the 20th of April.  (to avoid confusion you need to use the
enum Calendar.MAY)

I think it was genuine mistake rather than intentional, but you can
imagine the bugs that has caused.  I doubt many bugs have come from
XPath's 1 based index.


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

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.