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