XInclude の XSLT 実装を使用します。
<content xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="example.xml"/>
<user authorizeds="false"/>
</content>
テンプレートを既存のスタイルシートに追加する:
<!-- ==============================================================
XInclude implementation
Implements XInclude by processing the entire doc
to produce a single result tree with all the includes resolved
and then applies the normal template processing to that document.
==============================================================-->
<xsl:template match="/">
<xsl:choose>
<xsl:when test="//xi:include">
<xsl:variable name="resolved-doc">
<xsl:apply-templates mode="xinclude"/>
</xsl:variable>
<xsl:apply-templates select="$resolved-doc" mode="normal"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/" mode="normal">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="node()" mode="xinclude">
<xsl:copy
><xsl:call-template name="xinclude-copy-attributes"
/><xsl:apply-templates select="node()" mode="xinclude"
/></xsl:copy>
</xsl:template>
<xsl:template match="xi:include" mode="xinclude">
<xsl:variable name="xpath" select="@href"/>
<xsl:choose>
<xsl:when test="$xpath != ''">
<xsl:message>Including <xsl:value-of
select="$xpath"/></xsl:message>
<xsl:apply-templates
select="xptrf:resolve-xpointer-url(.)" mode="xinclude"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>Xinclude: Failed to get a value for the href= attribute
of xi:include element.</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
参考文献