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

Subject: Re: [xsl] [XSLT 1.0] Q: recursively eliminate empty nodes
From: Evan Lenz <evan@xxxxxxxxxxxx>
Date: Fri, 12 Nov 2010 23:18:54 -0800
On 11/12/10 9:54 AM, Wendell Piez wrote:
At 09:40 PM 11/11/2010, you wrote:
A rule I find easy to remember is that a pattern has the highest default priority (0.5) if and only if it contains a "/", "//", or "[..]"

Hm. So does it have the lowest if and only if it doesn't have any of these, or ":" (indicating a namespace prefix), but it does have "*" or "()"? (indicating a wildcard or kind test?)


The lowest-priority patterns are special in that you can exhaustively enumerate them all.

For XSLT 1.0, I created a table listing these:
http://lenzconsulting.com/how-xslt-works/#priority

There are only 6 patterns (not including their alternate "child::" or "attribute::" forms) that have a default priority of -0.5. That's because it's the only default priority level where no names (or steps or filters) are used. XSLT 2.0 adds a few more to the list with the ElementTest and AttributeTest forms.

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. I was surprised to see this. Maybe it has no practical impact (other than invalidating my easy-to-remember rule). Or am I missing something?

Evan

--
Evan Lenz
Lenz Consulting Group, Inc.
http://lenzconsulting.com
+1 (360) 297-0087

Current Thread