RE: [xsl] Re: error in xsl:key

Subject: RE: [xsl] Re: error in xsl:key
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 19 Sep 2008 18:00:24 +0100
> One can argue other way: key() function should never return a 
> node for which evaluation of use resulted in an error.

Firstly, key() is defined to return "every node $N that satisfies the
following conditions:". It doesn't define which order the conditions are
applied in; for example it doesn't say whether you evaluate the use
expression for every node in the universe, and then look at the subset of
these that are in the subtree rooted at $top (the third argument), or
whether you first look in the subtree and then evaluate the use condition.
Saxon searches the document containing $top for all nodes that match the
match pattern, evaluates the use expression for all of these, and then sees
which of these are in the subtree rooted at $top. But other strategies are
allowed.

Concerning errors, section 2.9 says:

Because different implementations may optimize execution of the stylesheet
in different ways, the detection of dynamic errors is to some degree
implementation-dependent. In cases where an implementation is able to
produce the final result trees without evaluating a particular construct,
the implementation is never required to evaluate that construct solely in
order to determine whether doing so causes a dynamic error.

There are a few situations in which errors are recoverable (for example, an
error in evaluating the match pattern of a template - but NOT the match
pattern of a key). These are clearly described as such in the spec. All
other dynamic errors are non-recoverable.

Michael Kay
http://www.saxonica.com/

Current Thread