Advanced XSLT: Includes and Imports

What we've done here is useful for one file, but we can make it even more useful. The top part of the file, including any header graphics and the links to other sections of the site, really belong on every page of the site. What would be helpful is the capability to take that information and separate it out into a page that we can use in many different places.


One way that XSLT provides for us to do that is by allowing us to include one style sheet within another. All we need to do is separate out our reusable information into a style sheet of its own and then call it from whatever page we want. The actual reusable style sheet looks like Listing 4.3.

Listing 4.3. topinclude.xsl: Our Reusable Style ...

Get XML and Java™ from scratch 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.