xsl:include Element

Specifies an XSL Transformation (XSLT) style sheet to include.

<xsl:include
  href = "URI-reference" />

Attributes

  • href
    [required] A Uniform Resource Identifier (URI) reference identifying the style sheet to be included.

Element Information

Number of occurrences Unlimited
Parent elements xsl:stylesheet, xsl:transform
Child elements (No child elements)

Remarks

An XSLT style sheet can include another XSLT style sheet using the <xsl:include> element. The href attribute value is a URI reference identifying the style sheet to be included. The relative URI is resolved with relation to the base URI of the <xsl:include> element.

The <xsl:include> element is only allowed as the child of the <xsl:stylesheet> element.

Inclusions are processed in the Microsoft® XML Parser (MSXML) as if they occurred at the tree level. Note that this is not the same as the Document Object Model (DOM) view of the XML tree. The resource located by the href attribute value is parsed as an XML document, and the children of the <xsl:stylesheet> element in this document replace the <xsl:include> element in the including document. The fact that template rules or definitions are included does not affect the way they are processed.

An error occurs if a style sheet directly or indirectly includes itself.

Including a style sheet multiple times can cause errors because of duplicate definitions. Such multiple inclusions are less obvious when they are indirect. For example, if style sheet B includes style sheet A, style sheet C includes style sheet A, and style sheet D includes both style sheet B and style sheet C, then A will be included indirectly by D twice. If all of B, C, and D is used as independent style sheets, the error can be avoided by separating everything in B other than the inclusion of A into a separate style sheet B1 and changing B to contain just inclusions of B1 and A, doing the same for C, and then changing D to include A, B1, C1.

See Also

XSLT Elements | xsl:import Element

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.