I think this is all true. Some comments attached.
On 2 Apr 2014, at 15:51, Abel Braaksma (Exselt) <abel(_at_)exselt(_dot_)net>
wrote:
Apart from positional predicates, I am not sure whether any of these
have any official bearing, as in whether they are elswehere defined as such.
We might have used some of these terms in the streamability analysis, but they
certainly aren't official terms in 2.0.
Now the question. After the discussion on position(), I started
wondering about patterns and position. I believe the following is all
true (assume they the patterns are placed inside <xsl:template match="XXX">.
Selects nothing, ever (not even in a select-expression):
foo[2][3]
foo[0]
bar[last()][2]
Redundant [1], always redundant:
foo[2][1][1]
foo[3][1]/bar[4][1]
The rules I am after is, in this order:
1) numerical predicates lower than zero never select anything
More precisely, the only numerical predicates that can select anything are
positive integers.
2) a sibling numerical predicate that is one is always redundant in a
pattern
"Sibling numerical predicate" isn't one of your defined terms. I assume you
mean a predicate of [1] preceded by another numerical predicate.
3) a sibling predicate that is a sibling of a numeric predicate that is
higher than one never selects anything
Then, to make it tricky, what happens here, if the applied set is //foo?
(foo[2])[3]
This never selects anything, but (.//foo[2])[3] does. The difference is that
foo[2] always selects 0 or 1 elements, whereas .//foo[2] may select more than
one.
Bottom line is, I think, that creating multiple sibling numerical
predicates is (usually) counter-productive and won't match anything when
used in a pattern (unless the number is "1", in which case it is also
redundant).
More generally, an expression using a numeric predicate returns a value with
cardinality 0:1, and applying a numeric predicate to a value with cardinality
0:1 is pointless.
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>
--~--