XSLT <xsl:copy>
❮ Complete XSLT Element Reference
定义和用法
元素 <xsl:copy> 创建当前节点的副本。
注意:当前节点的命名空间节点也会被自动复制,但当前节点的子节点和属性不会被自动复制!
语法
<xsl:copy use-attribute-sets="name-list">
<!-- Content:template -->
</xsl:copy>
属性
Attribute | 值 | 描述 |
---|---|---|
use-attribute-sets | name-list | 可选。一个由空格分隔的属性集列表,如果节点是元素,则应用于输出节点。 |
示例 1
将消息节点复制到输出文档
<?xml version="1.0" encoding="UTF-8"?>
<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>
❮ Complete XSLT Element Reference