xsl:copy-of
xsl:attribute
xsl:attribute-set
ELEMENT: xsl:copy
<xsl:copy
use-attribute-sets="name-list"
>
</xsl:copy>
The
xsl:copy
element copies the current node in the source document to the output. The copy has the same name, namespace, and type as the original node, but any attributes, children, and other descendants are not copied. (Note that you can apply this element recursively to copy attributes and children.)
The
xsl:copy-of
element can be used to copy a node set. Children are copied with this element.
A common use of this element is to make identity transformations.
use-attribute-sets="name-list"
The optional
use-attribute-sets
attribute is a white-space delimited list of attribute sets that are to be applied to the generated node. This is essentially a list of qnames. A qname is a qualified name that is composed of an optional namespace prefix, a colon, which is only present if there is a prefix, and a mandatory XML name (for example, xsl:zipcode or zipcode). The
use-attribute-sets
attribute performs the same purpose as the
xsl:attribute
element.
We use the
DevGuru Staff List XML file
for our example with the following header:
<?xml-stylesheet type="text/xsl" href="xslt_example_copy.xsl"?>
and we name it: xslt_example_copy.xml
For our example, we display the standard code for making an identity transformation.
Code for xslt_example_copy.xsl:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/ | @* | node()">
<
xsl:copy
>
<xsl:apply-templates select="@* | node()" />
<
/xsl:copy
>
</xsl:template>
</xsl:stylesheet>
Output:
Click to view output in separate window
- requires Internet Explorer
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information