<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- xsl:import must occur before any other top-level elements -->
<xsl:import href="pageElements.xslt"/>
<xsl:import href="globalConstants.xslt"/>
<xsl:output method="html"/>
<xsl:template match="/">
<html>
...
</html>
</xsl:template>
<!-- but xsl:include can occur anywhere, provided it is a top-level element -->
<xsl:include href="nameFormatting.xslt"/>
</xsl:stylesheet>
For the purposes of most web sites, the most common usage pattern is
for each page to import or include common stylesheet fragments, such
as templates to produce page headers, footers, and other reusable
elements on a web site. Once a stylesheet has been included or
imported, its templates can be used as if they were in the current
stylesheet.
The key reason to use <xsl:import> instead
of <xsl:include> is to avoid conflicts. If
your stylesheet already has a template that matches
pageHeader, you will not be able to include
pageElements.xslt if it also has that template.
On the other hand, you can use <xsl:import>.
In this case, your own pageHeader template will
take priority over the imported pageHeader.