この XML ドキュメントをブラウザで開くと、次のようになります。
<?xml-stylesheet type="text/xsl" href="stylesheet.xsl"?>
<node>
-Include Contents of b.xml
</node>
この XSLT スタイルシート (他のXML ドキュメント) をstylesheet.xsl
相対 URI で参照すると、次のようになります。
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="node">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:copy-of select="document('B.xml')"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
次のようにレンダリングされます (スタイルなし、またはブラウザーの既定の XML スタイルシートを使用):
<node>
<anode>a</anode>
</node>
注: 処理命令。xsl:copy-of
可能性のある無限再帰と混同したくなかったので、命令を使用しました...