[xsl] Preference rules for /something and /*

Subject: [xsl] Preference rules for /something and /*
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Mon, 18 Jun 2007 22:07:58 +0200
Hi List,

I'm not sure if I get this right, so I'm asking here. If I have the following two rules:

<xsl:template match="/root" />
<xsl:template match="/*" />

I receive an "ambiguous rule match" error if the input matches the first. I figured, '*' is not very selective, so it should've conceived lowest priority (I know that a single '*' has prio -.5). What I'd guess is that I am having a compound rule here, similar to 'node/child' or 'node/*' which both receive prio +.5, with the parent node being the document node. Am I correct? Or should a processor distinguish and select the first as having a higher prio (which intuitively seems more correct)?

Of course I can use priority='x', but I'm curious about the default prio here.

-- Abel

PS: the same happens when I over-specify the first rule, i.e.: /root[foo[bar='y']]

Current Thread