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

Subject: Re: [xsl] Why are these two template rules ambiguous?
From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 23 Aug 2022 17:20:19 -0000
Hi,

Yes, what David C says, plus the first template matches any
"airport//procedureLeg" while the second template matches only those that
have element children.

A rule of thumb is, "if you are unsure of how priority is being assigned by
default, use @priority". There is no harm in it and it is necessary in many
cases. The default priority rules are not hard, but they might not be
*exactly* what you think.

Cheers, Wendell


On Tue, Aug 23, 2022 at 12:42 PM David Carlisle d.p.carlisle@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

>
>
> 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
>>
>>
>> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/174322> (by
> email <>)
>


-- 
...Wendell Piez... ...wendell -at- nist -dot- gov...
...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...

Current Thread