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

Re: stylesheet organisation

Subject: Re: stylesheet organisation
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Sat, 03 Sep 2011 15:59:17 +0100
Re:  stylesheet organisation
On 03/09/2011 14:59, Michael Kay wrote:
On 03/09/2011 09:17, Jesper Tverskov wrote:
Mark asked:

"Is there a significant difference between xsl:import and xsl:include
worth learning?"

The only difference between xsl:import and xsl:include is that
xsl:import must be the very first child of xsl:stylesheet.

This means that if the importing stylesheet has templates that matches
with same priority as the templates in the imported stylesheet, the
templates in the importing stylesheet are sure to win out because they
are after the templates in the imported stylesheet.

That is you never really need to use xsl:import. If you make sure that
an xsl:include is the very first child of xsl:stylesheet, it works
exactly as if xsl:import had been used.


Wrong!

As far as template rules are concerned, it's an error to have two templates matching the same node, but processors are allowed to recover from the error by choosing the one that comes last in declaration order. For a processor that chooses the recovery strategy, xsl:import has the same effect as xsl:include.
Sorry, I was oversimplifying. There's more difference than this suggests. It's only true where template rules have the same priority. Given two template rules of different priority, for example <xsl:template match="*"> and <xsl:template match="x">, if you use xsl:include then the higher priority one will win (match="x"), while if you use xsl:import then the one that is first in the import tree will win.

Michael Kay
Saxonica

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.