Talk:Identity transform

The Oct. 28 revisions (first 3 at least) were mine. I hadn't noticed that I wasn't logged in. Huttarl (talk) 18:27, 28 October 2010 (UTC)

about XSLT copy-of?
There are a simple way to copy all in XSLT, and, for identity, copy-of select="." —Preceding unsigned comment added by 186.223.215.33 (talk) 22:08, 5 March 2011 (UTC)
 * Yes, that’s true, of course. However, the copy-of element will always generate an identical copy, including all descendant nodes. You will have no chance to make any modifications along the way. Sometimes that’s okay, but the beauty of the recursive approach is that you can copy the bulk of your input document as-is, and still make small (or large) changes wherever you want them. There is now an example for this technique in the section Remove named element transform. This can be very powerful, and it’s not as inefficient (= slow) as you might think. It seems that decent XSLT processors are able to recognise the recursive identity template and handle it efficiently. [citation needed] --89.246.127.31 (talk) 15:33, 17 June 2021 (UTC)

Missing text in the explicit version?
In the explicit version, apply-templates selects all of this: "@*|*|text|processing-instruction|comment", but the template only matches this: "@*|*|processing-instruction|comment". Shouldn't "text" be listed in what the template will match, as well? If not, why is it not needed? —DavidConrad (talk) 17:17, 11 March 2013 (UTC)
 * Yes, the node test for “text” should probably be included in the “match” attribute, because the example is confusing without it. However, this is not strictly necessary because XSLT provides a built-in template rule that does the right thing for text nodes automatically: It simply copies their value to the result tree. Since text nodes cannot have children, this built-in template rule is sufficient ‒ but it’s hidden within the language specification. --89.246.127.31 (talk) 15:09, 17 June 2021 (UTC)