[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: Wed, 21 May 2008 04:00:37 +0900
Re:  One-based indexes in XPath
Seems to me that the historical argument for 1 as opposed to a 0 based
index is a good one.  Just like tobacco and alcohol, being rather addictive
substances, would otherwise be on a government perscription-only list if
they were invented today.

However, my original question remains true to XSL List agenda.

Say we contrive some xsl like this (sure script is somewhat frowned upon in
XSLT) :=

<xsl:variable name="ns" select="thingy"/>
<xsl:variable name="nslen" select="count( $ns)"/>

	for ( var i = 0; i < $nslen; ++i)  {
		do_something_with( $ns, i);

Going from XSL-world to a non-XSL-script (extension library) world can
cause confusion with 0 or 1 based indexes.

Would it be better to design an XSL extension library (implemented in say
Javascript) to have a 1-based index for parameter calling conventions into
that library rather than a 0-based index which has more of the feel fot the
native/external scripting language?

Justin Johansson

Current Thread


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.
First Name
Last Name
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.