XSLT <xsl: copy>
❮ Toàn bộ tham chiếu phần tử XSLT
Định nghĩa và Cách sử dụng
Phần tử <xsl: copy> tạo một bản sao của nút hiện tại.
Lưu ý: Các nút không gian tên của nút hiện tại cũng được tự động sao chép, nhưng các nút con và thuộc tính của nút hiện tại không được sao chép tự động!
Cú pháp
<xsl:copy use-attribute-sets="name-list">
<!-- Content:template -->
</xsl:copy>
Thuộc tính
Attribute | Value | Description |
---|---|---|
use-attribute-sets | name-list | Optional. A white space separated list of attribute-sets to apply to the output node, if the node is an element |
ví dụ 1
Sao chép nút thông báo vào tài liệu đầu ra:
<?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>
❮ Toàn bộ tham chiếu phần tử XSLT