XSLT <xsl:copy> 元素

2018-02-12 16:07 更新

XSLT <xsl:copy> 元素

XSLT <xsl:copy> 元素用于創(chuàng)建當(dāng)前節(jié)點(diǎn)的一份拷貝。


XSLT 元素參考手冊(cè) 完整的 XSLT 元素參考手冊(cè)

定義和用法

<xsl:copy> 元素可創(chuàng)建當(dāng)前節(jié)點(diǎn)的一個(gè)副本。

注意:當(dāng)前節(jié)點(diǎn)的 Namespace 節(jié)點(diǎn)會(huì)被自動(dòng)復(fù)制,但是當(dāng)前節(jié)點(diǎn)的子節(jié)點(diǎn)和屬性不會(huì)被自動(dòng)復(fù)制!


語法

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

<!-- Content:template -->

</xsl:copy>

屬性

屬性 描述
use-attribute-sets name-list 可選。如果該節(jié)點(diǎn)是元素,則該屬性是應(yīng)用到輸出節(jié)點(diǎn)的屬性集列表,由空格分隔。

實(shí)例 1

把 message 節(jié)點(diǎn)拷貝到輸出文檔:

<?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 元素參考手冊(cè) 完整的 XSLT 元素參考手冊(cè)

在下一節(jié)內(nèi)容中,你將會(huì)了解 <xsl:copy-of> 元素!請(qǐng)注意區(qū)分 <xsl:copy-of> 元素和 <xsl:copy> 元素!

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)