The <xsl:import> Element

Like <xsl:include>, <xsl:import> enables you to insert a stylesheet or stylesheet fragment in another stylesheet. And like <xsl:include>, <xsl:import> has only one attribute:

  • href (mandatory). The URI of the stylesheet you want to include.

Also like <xsl:include>, <xsl:import> is empty and has no content. So what’s the difference between <xsl:include> and <xsl:import> ? The difference lies in import precedence.

Import precedence gives the XSLT processor a way to settle any conflicts that may arise when, for example, two rules match the same node. The precedence of an imported stylesheet or stylesheet fragment is lower than the precedence of the stylesheet that’s importing it. And if you import several stylesheets or ...

Get Inside XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.