I have seen lots of posts that do something like this and that makes me feel like this is possible and I am just doing something wrong. I have simplified it as much as possible to try and figure out why this is happening:
Heres my xml (nothing very exciting):
<?xml version="1.0" encoding="UTF-8"?>
<REPORT>
</REPORT>
Here is my xsl:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="REPORT">
<xsl:variable name="tryThisTemplate">
<xsl:call-template name="TRY_THIS"/>
</xsl:variable>
<TEST1>
<xsl:call-template name="TRY_THIS"/>
</TEST1>
<TEST2>
<xsl:value-of disable-output-escaping="yes" select="$tryThisTemplate" />
</TEST2>
<TEST3>
<xsl:value-of select="$tryThisTemplate" />
</TEST3>
</xsl:template>
<xsl:template name="TRY_THIS">
<MY_NODE desc="my description" />
</xsl:template>
</xsl:stylesheet>
Here is my result:
<?xml version="1.0" encoding="utf-8"?>
<TEST1>
<MY_NODE desc="my description"/>
</TEST1>
<TEST2></TEST2>
<TEST3></TEST3>
Here is my question: How come TEST2 and TEST3 don't work. The $tryThisTemplate variable appears to be blank. Am I misunderstanding something here. Should I be doing this in a different way?