RE: [xsl] No-output identity template?

Subject: RE: [xsl] No-output identity template?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 23 Jan 2003 15:02:33 -0500
At 2003-01-23 10:23 -0600, Roger Glover wrote:
G. Ken Holman wrote:
> <xsl:template match="menu/item" mode="sub-menu" priority="-1"/>
>
> This will not conflict with match="item[item]" because the inferred
> priority of that rule is ".5".

Is there a reason not just use 'match="item[not(item)]"' instead?

Actually, the most compact would just be:


<xsl:template match="item" mode="sub-menu"/>

Because the inferred priority is 0, this doesn't conflict with the earlier match.

I didn't think to suggest this earlier because I didn't realize that *two* different modes were being used: sub-menu and sub-menu-item.

This
seems to me to express the desired behavior more precisely,

Well, perhaps the above is even more precise. Again, I was hung up thinking there was only one mode, so I had to use parentage to distinguish the items. When two modes are being used, then in the sub-menu mode you can have the .5 priority qualified template rule and the 0 priority template rule without template rule conflict.


Had there been only one mode, then the parentage was necessary.

And, had there been only one mode your suggestion would not have worked because it would have been triggered by the nested template rule. Since there are two modes, your suggestion would work just fine, as would mine above.

and it does not
require the priority setting to work correctly in the general case.

I'm sorry that I cannot comment on this statement because I do not understand what you are positing.


................... Ken


-- Upcoming hands-on in-depth Europe: February 17-21, 2003 XSLT/XPath and/or XSL-FO North America: June 16-20, 2003

G. Ken Holman                mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.         http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                      Definitive XSLT and XPath
ISBN 0-13-140374-5                              Definitive XSL-FO
ISBN 1-894049-08-X  Practical Transformation Using XSLT and XPath
ISBN 1-894049-10-1              Practical Formatting Using XSL-FO
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread