[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Numeric top-level predicates in patterns


Subject: Re: [xsl] Numeric top-level predicates in patterns
From: "Abel Braaksma (Exselt)" <abel@xxxxxxxxxx>
Date: Wed, 02 Apr 2014 20:50:31 +0200

On 2-4-2014 20:32, David Carlisle wrote:
>
> That is why I think Michael defined it as he did. [1] is only
> redundant if the preceding sequence is known to be at most 1.
>
> So [1] is a numerical predicate and a sibling predicate in
>
> $foo[true()][1]
>
> but it is not redundant.

This is true.

While I emphasized patterns specifically, Michael generalized it with
his remark on cardinality. My original post was on sibling predicates,
where [1] is added to the right of an existing numeric predicate, in
which case it is a no-op, because the cardinality is already 0:1. But in
your example, assuming we don't know statically that $foo is a sequence
of zero or one, then indeed, it is surely not redundant.

Cheers,
Abel


Current Thread