xsl:import element is always used at the top level of the stylesheet, and it must
appear before all other elements at the top level. It has a
href attribute, which is a URL (absolute or relative) of another stylesheet
to be textually included within this one. The top-level elements of the included stylesheet
effectively replace the xsl:import element.
xsl:import element may also be used at the top level of the included stylesheet, and so
The elements in the imported stylesheet have lower precedence than the elements in the importing stylesheet. The main effect of this is on selection of a template when xsl:apply-templates is used: if there is a matching template with precedence X, all templates with precedence less than X are ignored, regardless of their priority.
To customize the way in which the
href attribute is handled, a user-written
URIResolver can be supplied. Note that it is the compile-time
URIResolver that is used,
not the run-time
URIResolver. See also Using XML Catalogs.
XSLT 3.0 removes the restriction that
xsl:import element must precede all others in the stylesheet.
Saxon 9.5 removes the restriction provided that XSLT 3.0 is enabled.