XSLT <xsl:copy> 元素


XSLT 元素參考手冊 完整的 XSLT 元素參考手冊

定義和用法

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


XSLT 元素參考手冊 完整的 XSLT 元素參考手冊