xsl-list
[Top] [All Lists]

Re: [xsl] index-of and empty stuff

2013-12-21 16:02:27
and indeed turns out there are some improvements that can be done to
the code if I do this.

On Sat, Dec 21, 2013 at 9:56 PM, Ihe Onwuka 
<ihe(_dot_)onwuka(_at_)gmail(_dot_)com> wrote:
ok, I can see how I got into this then. My control argument comes from
a source document field that may not be populated.

Thanks. That's useful to know - it does influence how one (or I)
should think about a problem - perhaps capturing the empty sequence
case further upfield rather than relying on index-of to bale me out
and do the right thing.

On Sat, Dec 21, 2013 at 9:18 PM, Michael Kay <mike(_at_)saxonica(_dot_)com> 
wrote:

On 21 Dec 2013, at 20:42, Ihe Onwuka <ihe(_dot_)onwuka(_at_)gmail(_dot_)com> 
wrote:

Of course I was not in the room . There may be a very good reason - it
is not at all apparent. If there is a good reason it's worth knowing
(in fact it's also worth knowing if there isn't a good reason) so
please bear with my question(s).


If you want a historical evidence-based answer to the question, why was it 
designed like this, you won't get one. It's very rarely possible to find a 
specific decision minuted in enough detail to reconstruct the decision 
process.

However, the general rationale for XPath 2.0 functions was:

* arguments are classified into "input" and "control" arguments. Input data 
is data likely to come from the source document, while control arguments 
define how the input data is to be processed.

* input data arguments generally accept an empty sequence, and the function 
generally either (a) treats an empty sequence as a zero-length string, or 
(b) returns an empty sequence if an empty sequence is supplied

* control arguments generally do not accept an empty sequence.

* in the case of index-of(), the first argument is considered a data 
argument, and the second a control argument.

But of course there are inconsistencies, if only because this rationale was 
not retrospectively applied to 1.0 functions for compatibility reasons.

Michael Kay
Saxonica


--~------------------------------------------------------------------
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>
--~--


--~------------------------------------------------------------------
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>
--~--