[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: "Kevin Grover" <kevin@xxxxxxxxxxxxxxx>
Date: Tue, 20 May 2008 21:31:23 -0700
Re:  One-based indexes in XPath
On Tue, May 20, 2008 at 11:20 AM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
>> But I think 0 based indexes in low level languages (I
>> consider Java or C to be low level than XPath. Even I am
>> talking about assembly
>> languages.) have relation to hardware addressing.
>
> I don't think hardware addressing is the only benefit of 0-based addressing.
> It also makes computations easier. If you number the rows and columns on a
> chessboard from 0-7, and the squares from 0-63, then the square number is
> row*8+column, whereas with 1-based addressing it is (row-1)*8+column.

Shouldn't that last equation be (row-1)*8+column-1 ?

>
> And we do sometimes use 0-based logic in real life too. In many countries
> the "first floor" is the one above where you enter the building; and in many
> societies a child is "1 year old" between 12 months and 24 months after
> their birth.
>
> But on balance I do think 1-based logic was the right choice for XPath and
> XSLT.
>
> 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.