[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: One-based indexes in XPath
A quick thought from me. Let's say, we have to select a node as following: following-sibling::xx[1] To me traversal on following (or say preceding) axis will make sense if indexes start from 1. On Tue, May 20, 2008 at 10:44 PM, Justin Johansson <procode@xxxxxxxxxxx> wrote: > Trusting this question is relevant to the XSL List. > > Would someone please give me advice as to why "1-based" indexes are used in > XPath, such as para[1] instead of para[0] for the first para item/element? > > Why does the spec for XPath (and its/XQuery operator/function library) go > against the norm for modern programming languages in which zero is the base > for array-like collections? > > The reason for my question is to do with reconciling XPath and XSLT with an > implementation in Javascript in which zero is the base index for arrays. > My users may well be perplexed by having to decide whether an index number > is in XPath/XSLT-world or Javascript-world. > > Thanks for comments, > > Justin Johansson -- Regards, Mukul Gandhi
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|