xsl-list
[Top] [All Lists]

Re: [xsl] One-based indexes in XPath

2008-05-20 11:31:03
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)"/>

<xslex:script>
        for ( var i = 0; i < $nslen; ++i)  {
                do_something_with( $ns, i);
        }
</xslex:script>

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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>