xsl-list
[Top] [All Lists]

Re: [xsl] Determining the context node

2006-04-14 08:30:43
I wrote:
contained other elements) you would get nothing.
For all node types except for elements, <xsl:copy/> behaves exactly the same as <xsl:copy-of select="."/>
I should qualify that. If the current node is a root node, then it just instantiates the content of <xsl:copy> (no different than if <xsl:copy> weren't there). That's because you never copy root nodes (they're created automatically).

The way the XSLT 1.0 spec defines <xsl:copy> is that it copies the current node but excludes any children or attributes of the current node.

Effectively, for nodes that never have children or attributes anyway (namely: attributes, text nodes, processing instructions, namespace nodes, and comments), the behavior is the same as <xsl:copy-of select="."/>.

However, for elements and root nodes, <xsl:copy-of select="."/> performs a deep copy, including all attributes (when the current node is an element) and child nodes (when the current node is an element or root node).

Evan

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--