XSLT <xsl:copy> 元素
定義和用法
<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>