マークアップ要素の名前が、対応する Html 要素の名前と同じでない場合、たとえば次のようになります。
<decision>
<akapit nr="1">
This is
<bold>important</bold> decision for the query number
<italic>0123456</italic>
</akapit>
</decision>
次に、同一性ルールの非常に単純なアプリケーションは次のとおりです。
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="akapit">
<div><xsl:apply-templates/></div>
</xsl:template>
<xsl:template match="bold"><b><xsl:apply-templates/></b></xsl:template>
<xsl:template match="italic"><i><xsl:apply-templates/></i></xsl:template>
<xsl:template match="/*"><xsl:apply-templates/></xsl:template>
</xsl:stylesheet>
この変換が上記の XML ドキュメントに適用されると、必要な正しい結果が生成されます。
<div>
This is
<b>important</b> decision for the query number
<i>0123456</i>
</div>
注意:後者は、選択したノードをさらに処理する柔軟性を持たないため、使用することをお勧めします。それらをコピーするだけですxsl:apply-templates
。xsl:copy-of