Re: [xsl] Why are these two template rules ambiguous?

Subject: Re: [xsl] Why are these two template rules ambiguous?
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 23 Aug 2022 16:41:51 -0000
On Tue, 23 Aug 2022 at 17:35, Roger L Costello costello@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi Folks,
>
> I have these two template rules:
>
> <xsl:template match="procedureLeg[ancestor::airport]">
> <xsl:template match="*[child::*]">
>
> When the <procedureLeg> element is encountered in the instance document,
> Saxon throws a warning, saying that it is ambiguous which rule to use.
>
> But, but, but, ...
>
> Clearly the first rule is more specific.


"specific" isn't a defined term here though. They both have the same
default priority.

Default priority is based on some simple rules on the structure (and both
of these have [..])
it explicitly does not do logical analysis to determine "anything that
matches the first pattern must match the second", which is what  I guess
you mean by specific here.

David




> I thought the XSLT specification says: the more specific rule wins. Right?
> So why is Saxon throwing a warning message?
>
> I know that I can add "priority" to the first rule and then the warning
> will go away, but I shouldn't have to do that, right?
>
> /Roger

Current Thread