This was probably the first time in my years of working with XSLT that
it occurred to me to capture <xsl:apply-templates/> in a variable
(I'll never be an XSLT wizard). I'm wondering: is the procedure above
guaranteed to work in all cases, or is it possible that the
<xsl:copy-of select="$appliedTemplates"/> could ever return something
different from <xsl:apply-templates/> in this context?
Doing xsl:copy-of on the variable is perfectly safe. Doing
apply-templates or other processing on it can be risky - because the
copied nodes differ from the original by having fewer ancestors, so
logic that looks outside the immediate subtree will behave differently.
On a related point, people often use xsl:message to produce diagnostic
output. I often find it more helpful to put the diagnostic data in the
result document itself, so you'll see me writing stuff like
<xsl:variable name="v" select="....."/>
<debug var="$v">
<xsl:copy-of select="$v"/>
</debug>
Michael Kay
Saxonica
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--