次の方法で共有


xsl:copy Element (Windows Embedded CE 6.0)

1/6/2010

Copies the current node from the source to the output.

Syntax

<xsl:copy
  use-attribute-sets = QName>
</xsl:copy>

Attributes

  • use-attribute-sets
    A white space-separated list of attribute sets specified as a qualified name. Specifying a use-attribute-sets attribute is equivalent to adding <xsl:attribute> elements for each of the attributes in each of the named attribute sets to the beginning of the content of the element with the use-attribute-sets attribute, in the same order in which the names of the attribute sets are specified in the use-attribute-sets attribute. It is an error if use of use-attribute-sets attributes on <xsl:attribute-set> elements causes an attribute set to directly or indirectly use itself.

Element Information

Number of occurrences

Unlimited

Parent elements

xsl:attribute, xsl:comment, xsl:element, xsl:for-each, xsl:if, xsl:otherwise, xsl:param, xsl:processing-instruction, xsl:template, xsl:variable, xsl:when, xsl:with-param, output elements

Child elements

xsl:apply-templates, xsl:attribute, xsl:call-template, xsl:choose, xsl:comment, xsl:copy-of, xsl:element, xsl:for-each, xsl:if, xsl:processing-instruction, xsl:text, xsl:value-of, xsl:variable, output elements

Remarks

The <xsl:copy> element creates a node in the output with the same name, name space, and type as the current node. Attributes and children are not copied automatically. This element makes identity transformation possible.

Example

The following example performs an identity transform on the entire document. The identity transform copies each node in the source to the output to provide a logically equivalent tree. It does not yield character-by-character equivalence — entities will be expanded and white space not marked as significant may be removed.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/ | @* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

Any XML file can be used with the above transform.

See Also

Reference

XSLT Elements