Re: Singleton focus in predicate expressions

If we were still entertaining new features, I would be inclined to do this as

<xsl:template match=“pattern” position=“1”>

But we aren’t…

(and it still leaves questions. Does it match the first thing in the sequence selected by apply-templates, or the first thing in that sequence that matches this pattern?)

Michael Kay
Saxonica


> On 30 Sep 2015, at 17:15, Abel Braaksma <abel.braaksma@xs4all.nl> wrote:
> 
>> In any case, in XPath expressions it is always true that ".[1]" selects 
>> the same thing as “.”, while “.[2]” selects nothing; so we’re being
>> faithful to XPath semantics. 
> 
> That makes sense. Perhaps somewhat unfortunate, but it follows the logic that any pattern can (trivially) be rewritten as an XPath expression.
> 
> Pondering about co-existence: there is no way with the XSLT 2.0 syntax, but with the dot-syntax, which applies to both nodes and atomic items, this *could* be defined as "the context item, with context size and position set to their respective values in the current match selection". It is then still equivalent to XPath (as any XPath inside a similar for-each, if you replace it with if(predicate) then). That way, while non-predicate patterns can only select elements and the position on some axis, dot-syntax, which matches "anything", then matches the position in the match selection.
> 
> I say "could", because I know we aren't changing stuff anymore. It is good to know, however, the rationale behind the current feature description.
> 
> Cheers,
> Abel
> 
> 

Received on Wednesday, 30 September 2015 16:30:38 UTC