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>