Latest web development tutorials

XSLT <xsl: copy> element

XSLT Elements Reference Manual Complete XSLT Element Reference Manual

Definition and Usage

<Xsl: copy> element creates a copy of the current node.

Note: Namespace current node are automatically copied, but the current child nodes and attribute nodes will not be automatically copied!


grammar

<xsl:copy use-attribute-sets="name-list">

<!-- Content:template -->

</xsl:copy>

Attributes

属性 描述
use-attribute-sets name-list 可选。如果该节点是元素,则该属性是应用到输出节点的属性集列表,由空格分隔。

Example 1

Copy the message node to the output document:

<?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>


XSLT Elements Reference Manual Complete XSLT Element Reference Manual