[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Difference between import and include


Subject: RE: [xsl] Difference between import and include
From: Jeff Beadle <Jbeadle@xxxxxxxx>
Date: Mon, 28 Jan 2002 13:18:36 -0500

Khalid,

xsl:include means to include the referenced xsl document (b.xsl) within your
referencing document (a.xsl).  You cannot have two templates with the same
matching signature: name, or (match and/or mode).

xsl:import, in essence, means that if b.xsl "imports" a.xsl then b.xsl
is--in effect--sub-classing a.xsl.
If a.xsl has a template named "X" and b.xsl has a template named "X", then
xslt processor will use the call the "X" template from the b.xsl document.  

Basically, (this is from the msxml sdk) "importing a style sheet is the same
as including it except that definitions and template rules in the importing
style sheet take precedence over those in the imported style sheet."

In brief,
I consider xsl:include to be good for sharing utility templates (and such)
between xsl documents, and xsl:import for more of an xslt framework
implementation.


How the processors actually handle the two xslt elements is kind of cool,
you may want to refer Mike Kay's book (Professional XSLT 1st or 2nd Ed.) for
a good explanation.

-Jeff


-----Original Message-----
From: Khalid [mailto:k_ali@xxxxxxxxxxxxxxx]
Sent: Monday, January 28, 2002 12:46 PM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Difference between import and include


Hi,
Can some one tell me the difference between include or import?
Basically I was wondering that is it possible to use either one of the xsl:
commands to inlude or import a spcific xsl template at a particular point in
the xsl file,kind of like calling a method inside of a method e.g

function mainXSLT(){
 print some stuff
 print some other stuff
 call the include or import able xsl file
 print some other stuff

}
Thanks in advance
Khalid

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

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



Current Thread
Keywords