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 >>


Copyright © dpunkt.verlag GmbH 2004
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSL-FO in der Praxis" ("XSL-FO in practice") is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.

dpunkt.verlag GmbH, Ringstraße 19B, 69115 Heidelberg, fon 06221-14830, fax 06221-148399,