Reputation: 15
The xsl copy function appears to deviate from the functional hierarchical pattern of the copy-of in that it doesn't assess the select condition (if condition is an XPath axes) before applying the function action.
so xsl:copy select="ancestor::*"
will behave different than xsl:copy-of select="ancestor::*"
Upvotes: 0
Views: 121
Reputation: 163587
A select attribute is being added to xsl:copy in XSLT 3.0, to allow copying of nodes other than the context node (useful for example in a function). For XSLT 1.0 and 2.0, I really don't know what you mean.
Upvotes: 0
Reputation: 1094
At least in XSLT 1.0, xsl:copy
does not have a select attribute: it only copies the current node.
From the spec (emphasis mine):
The xsl:copy element provides an easy way of copying the current node. Instantiating the xsl:copy element creates a copy of the current node. The namespace nodes of the current node are automatically copied as well, but the attributes and children of the node are not automatically copied. The content of the xsl:copy element is a template for the attributes and children of the created node; the content is instantiated only for nodes of types that can have attributes or children (i.e. root nodes and element nodes).
Edit: XSLT2.0 xsl:copy
behaves the same way
Upvotes: 4
Reputation: 164341
Well, copy
and copy-of
are intended to do very different things. copy
always works on the current node and does not support the select
attribute. See http://zvon.org/xxl/XSLTreference/Output/xslt_copy.html vs http://zvon.org/xxl/XSLTreference/Output/xslt_copy-of.html.
Upvotes: 2