عنصر <xsl:copy> در XSLT

تعریف و استفاده

عنصر <xsl:copy> می‌تواند یک کپی از گره فعلی ایجاد کند.

توضیحات:Namespace node of the current node will be automatically copied, but the child nodes and properties of the current node will not be automatically copied!

عبارت‌نویسی

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