<xsl:copy-of select=”node()“ /> – will copy all nodes even insignificant text nodes, comment nodes, processing instruction nodes etc

<xsl:copy-of select=”*“ /> – will copy only element nodes

Initial doc:


<p>this is a test</p>

<p>more words</p>
<pre>

Results with node()

<p>this is a test</p>

<p>more words</p>

Result with *


<p>this is a test</p><p>more words</p>


2 responses

  1. I don’t think node() matches attributes? If it did, the identity template wouldn’t have to be:


    I other words, if node() matched attributes you could skip the @* part, but if you do it won’t copy any attributes.

    Like

    1. You are absolutely right… I’ve update the post. I think what I was looking for was comment nodes.

      Like

Leave a reply to itharm Cancel reply