XSLT <xsl:copy>要素

定義と用法

<xsl:copy>要素は現在のノードのコピー(コピー)を作成できます。

注釈:現在のノードのNamespaceノードは自動的にコピーされますが、現在のノードのサブノードおよび属性は自動的にコピーされません!

文法

<xsl:copy use-attribute-sets="name-list">
  <!-- Content:template -->
</xsl:copy>

属性

属性 説明
use-attribute-sets name-list オプションです。このノードが要素である場合、この属性は出力ノードに適用される属性セットのリストであり、スペースで区切られています。

例 1

message ノードを出力ドキュメントにコピーします:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0">
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="message">
  <xsl:copy>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>
</xsl:stylesheet>