What is the difference between 'xsl:copy-of' and 'xsl:sequence'
In very many situations they are interchangeable. One difference is that xsl:copy-of has more options (validation, copy-namespaces, etc). But most of the time you could use either.
There is a formal difference in that xsl:copy-of
creates new nodes, while xsl:sequence
returns a reference to existing nodes. That matters if, for example you use the "is" operator on the result, or if you use generate-id(), or if you navigate outside the subtree (e.g. to the parent of the copied node).
It's fair to say that 90% of the time people use xsl:copy-of
in preference to xsl:sequence
because that's what you did in XSLT 1.0, not because they really want a copy made.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With