What is the difference between xsl: copy and xsl: copy-of?

I do not see the difference between xsl:copyand xsl:copy-of.

Which should I use in what situation?

+4
source share
2 answers

In short , is a shallow copy; is a deep copy. xsl:copy xsl:copy-of

When to use xsl:copyvsxsl:copy-of

  • Use when you want to copy only the context element and have other plans for the children of the context element. xsl:copy
  • Use when you want to copy selected XPath nodes and their children, recursively. xsl:copy-of

Notes for xsl: copy

xsl:copy :

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

, node xsl:copy, xsl:apply-templates, .

xsl: copy-of

, xsl:copy-of , , .

+9

xsl:copy . , , node ( " " spec-speak). xsl:copy-of - . , node node. , .

+1

Source: https://habr.com/ru/post/1623647/


All Articles