Importing and Including Style Sheets
XSLT provides the <xsl:import>
and <xsl:include>
elements for incorporating the content of one style sheet within another.
This section contains the following topics.
- Initial Example for Importing Style Sheets
- Using <xsl:include> to Insert an XSLT File
- Using <xsl:import> to Insert an XSLT File with Lower Precedence
- Deciding Whether to Import or Include an XSLT File
- Avoiding Conflicting Rules by Using <xsl:apply-imports>
Note Using external parsed entities with DTDs
Because XSLT style sheets are XML documents themselves, you can also use XML's own simple facility for incorporating one XML document within another. This facility, the use of external parsed entities, is discussed in the XML Developer's Guide. The advantage of using such entities is that they are not constrained by any of the XSLT-specific rules governing the use of the<xsl:include>
and<xsl:import>
elements. They are only constrained by the rules of well-formed XML documents. The drawback of using such entities is that they require a Document Type Definition (DTD), which is not always practical or even possible.