On 11/13/10 4:58 AM, G. Ken Holman wrote:
At 2010-11-12 23:18 -0800, Evan Lenz wrote:
I just noticed (from here:
http://www.w3.org/TR/xslt20/#dt-default-priority) that in XSLT 2.0,
"/" has priority -0.5, whereas it has +0.5 in XSLT 1.0.
That's not my read from:
http://www.w3.org/TR/1999/REC-xslt-19991116#conflict
"Patterns less specific than this (patterns that just tests
for nodes with particular types) have priority -0.5.
I think that paragraph serves a more explanatory than normative role.
The algorithm described above it (in the bulleted list) does not include
"/" as having a default priority of -0.5. Therefore it must be +0.5.
You had me going for a second, until I saw this paragraph in the XSLT
2.0 Rec (item #17 under "Incompatibility in the Absence of a Schema"),
which confirms the change:
http://www.w3.org/TR/xslt20/#incompatibility-without-schema
"The default priority of the pattern match="/" has changed from +0.5 to
-0.5. The effect of this is that if there are any template rules that
specify match="/" with an explicit user-specified priority between -0.5
and +0.5, these will now be chosen in preference to a template rule that
specifies match="/" with no explicit priority; previously such rules
would never have been invoked."
Elsewhere Michael Kay responded:
> Retaining the 1.0 priority would have meant match="/" having a higher
priority than match="document-node(element(invoice))", which would be
counter-intuitive.
Thanks, Michael for explaining the rationale for the change. Makes
perfect sense. I'll have to update my rule for XSLT 2.0:
Except for "/" by itself, a pattern has the highest default priority
(0.5) if and only if it contains a "/", "//", or "[..]"
Evan
--
Evan Lenz
Lenz Consulting Group, Inc.
http://lenzconsulting.com
+1 (360) 297-0087
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--