<html>
<head>
<title>&lt;xsl:include&gt;</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="Description">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="NAME">&lt;xsl:include&gt;</td>
<td valign="top" class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td valign="top" colspan="2" class="description">
Allows you to include another XSLT stylesheet. This element allows you to put common transformations in a separate stylesheet, then include the templates from that stylesheet at any time. Unlike <span class="LITERAL">&lt;xsl:import&gt;</span>, all templates included with <span class="LITERAL">&lt;xsl:include&gt;</span> have the same priority as those in the including stylesheet. Another difference is that <span class="LITERAL">&lt;xsl:include&gt;</span> can appear anywhere in a stylesheet, while <span class="LITERAL">&lt;xsl:import&gt;</span> must appear at the beginning. </td></tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Category</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>Top-level element</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Required Attributes</td>
</tr>
<tr>
<td colspan="2" class="description">
<dl>
<dt>
href
</dt>
<dd>
Defines the URI of the included stylesheet.
<P></p>
</dl>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Optional Attributes</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>None.</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Content</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>None. <span class="LITERAL">&lt;xsl:include&gt;</span> is an empty element.</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Appears in</td>
</tr>
<tr>
<td colspan="2" class="description">
<p> <span class="LITERAL">&lt;xsl:include&gt;</span> is a top-level element and can appear only as a child of <span class="LITERAL">&lt;xsl:stylesheet&gt;</span>. </p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Defined in</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>XSLT section 2.6.1, Stylesheet Inclusion. </p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">

<p>The <span class="LITERAL">&lt;xsl:include&gt;</span> element is a good way
to break your stylesheets into smaller pieces. (Those smaller pieces
are often easier to reuse.) In our case study (see <link linkend="xslt-CHP-9">Chapter 9</link>), we had a number of different stylesheets, each
of which contained templates for a particular purpose. Here's how our
<span class="LITERAL">&lt;xsl:include&gt;</span> elements look:</p>

<span class="PROGRAMLISTING"><pre>
&lt;xsl:include href="toot-o-matic-variables.xsl"/&gt;

&lt;xsl:include href="xslt-utilities.xsl"/&gt;
&lt;xsl:include href="dw-style.xsl"/&gt;

&lt;xsl:include href="build-main-index.xsl"/&gt;
&lt;xsl:include href="build-section-indexes.xsl"/&gt;
&lt;xsl:include href="build-individual-panels.xsl"/&gt;
&lt;xsl:include href="build-graphics.xsl"/&gt;
&lt;xsl:include href="build-pdf-file.xsl"/&gt;
&lt;xsl:include href="build-zip-file.xsl"/&gt;</pre></span>
<p>Segmenting your stylesheets this way can make debugging simpler, as well. In our example here, all the rules for creating a PDF file are in the stylesheet <filename>build-pdf-file.xsl</filename>. If the PDF files are not built correctly, <filename>build-pdf-file.xsl</filename> is most likely the source of the problem. All visual elements of our generated HTML pages are created in the stylesheet <filename>dw-style.xsl</filename>. If we need to change the look of all the HTML pages, changing the templates in <filename>dw-style.xsl</filename> will do the trick. </p>
</td>
</tr>
</table>
</div>
</body>
</html>