[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: Justin Johansson <procode@xxxxxxxxxxx>
Date: Fri, 23 May 2008 01:28:20 +0900
RE:  One-based indexes in XPath
Suspicion incorrect Wendel.

I'm agnostic re 1-ness or 0-ness.  Just that it is a royal pain to have two
different systems and it is no more awkward to type p[1] or p[0].
Of course, as someone else pointed out, p[n] is short for p[position()=n]
and so to have 0-ness would impact upon last() and similarly related XPath
functions.

For the "kids" I prefer the teaching of arithmetic tables as follows:

     1  2  3  4  5  6  7  8  9
 10 11 12 13 14 15 16 17 18 19
 20 21 ...

leaving the first cell blank (or with the digit 0)

so as to make for better pattern recognition, for young brains, in a
decimal, or whatever base, system.

This debate has brought a lot of healthy traffic; pro's and con's; one god
or two; zero (gods) is definitely defamed by this list :-)

What is important, though, is that we do have an recognized standard (aka
recommendation), namely the XPath 2 Data Model (XDM).
(To my knowledge, XPath 1 lacked the rigorousness of an XDM).

Further, in the absence of any serious efforts elsewhere for
standardization, we, as members of this list, should advocate for the wider
adoption of the XDM beyond XPath in just XSLT or XQuery.

Given a few more years, it is quite possible that XPath 2 and the XDM will
find its way into areas that the (W3C) designers would never have imagined.

Just imagine the joy if all mainstream programming languages shared XDM as
the lowest common denominator.

Is this but a wish or something that we can aspire to in our generation?

Bests to all on this fine list,
Justin Johansson

--------------------------------------------------------------
Why should I care about future generations;
 what have future generations ever done for me?
Attrib: Groucho Marx
--------------------------------------------------------------

>Dijkstra wrote a note "Why numbering should start at zero":
><http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html>

This is great. Especially the confession that this most "natural" 

<cut/>

I agree that XSLT made the right decision, while I admit that it's 
sometimes awkward.

And I suspect that Justin agrees that if XSLT's designers had 
designed it so as to avoid any offense to Javascript programmers (or 
to callow youth of any persuasion), it would probably be even more 
awkward than it is.

Cheers,
Wendell

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.