[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: [XSLT 1.0] Q: recursively eliminate empty nodes

Subject: Re: [XSLT 1.0] Q: recursively eliminate empty nodes
From: Evan Lenz <evan@xxxxxxxxxxxx>
Date: Tue, 16 Nov 2010 07:10:10 -0800
Re:  [XSLT 1.0] Q: recursively eliminate empty nodes
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.