XML technologies / XSLT / XSLT introduction / Modularisation

The elements <xsl:import> and <xsl:include> make it possible to import stylesheets or stylesheet fragments. They differ in regard to the precedence of the import (ranking). When using <xsl:import>, the imported stylesheet has a lower precedence compared to the importing stylesheet. If two templates assign to the same element, the one not being imported is executed. Whereas when using <xsl:include>, the standard precedence rules apply in the same way as within a document. This means that the template applies which has referred more precisely (e.g. by using an absolute path) to the element in its XPath expression. If they are of equal value, the latter is used. The two empty elements only have a href attribute whose value contains the URI for the stylesheet to be included.

Such a call could be as follows:

<xsl:include href="style.xsl"/>

Exercise 8

a) Test the import instruction for your stylesheet.

b) Then "export" templates into another file.

> > to the solutions of exercise 8

   

<< back

to the XSLT solutions >>

 

back to top