Re: [xsl] stylesheet organisation

Subject: Re: [xsl] stylesheet organisation
From: Jesper Tverskov <jesper@xxxxxxxxxxx>
Date: Sat, 3 Sep 2011 10:17:16 +0200
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.

It is not true that "in general the rules and definitions in an
including stylesheet have the same precedence as the ones in the
included stylesheet."

Using xsl:include simply means that you don't know about precedence
without having to take a look in the merged stylesheets in order to
find out what comes last. That is not necessary when you use
xsl:import because the imported templates must come first.

Cheers
Jesper Tverskov
http://www.xmlplease.com

Current Thread