The ora:node-set() function can be used to convert a XML fragment into a node set. Once a XML fragment is converted into a node-set you can loop through it, or use XPath to access elements within it.
Example usage:
<xsl:template match="/">
<xsl:variable name="SessionContext">
<xsl:value-of select="app:getSessionContext()">
<!-- returns session context as a XML fragment with elements - ctx/UserName, ctx/LoginToken -->
</xsl:variable>
<xsl:apply-templates select="Record"/>
</xsl:template>
<xsl:template match="Record">
<RecordDetails>
<ColumnA><xsl:value-of select="./Record/ColA"></ColumnA>
<ColumnB><xsl:value-of select="./Record/ColB"></ColumnB>
<ColumnC><xsl:value-of select="./Record/ColC"></ColumnC>
<!-- access ctx values using xpath on variable -->
<ColumnC><xsl:value-of select="ora:node-set($SessionContext)/ctx/UserName"></UserName>
<ColumnC><xsl:value-of select="ora:node-set($SessionContext)/ctx/LoginToken"></UserName>
</RecordDetails>
</xs:template>

Example usage:
<xsl:template match="/">
<xsl:variable name="SessionContext">
<xsl:value-of select="app:getSessionContext()">
<!-- returns session context as a XML fragment with elements - ctx/UserName, ctx/LoginToken -->
</xsl:variable>
<xsl:apply-templates select="Record"/>
</xsl:template>
<xsl:template match="Record">
<RecordDetails>
<ColumnA><xsl:value-of select="./Record/ColA"></ColumnA>
<ColumnB><xsl:value-of select="./Record/ColB"></ColumnB>
<ColumnC><xsl:value-of select="./Record/ColC"></ColumnC>
<!-- access ctx values using xpath on variable -->
<ColumnC><xsl:value-of select="ora:node-set($SessionContext)/ctx/UserName"></UserName>
<ColumnC><xsl:value-of select="ora:node-set($SessionContext)/ctx/LoginToken"></UserName>
</RecordDetails>
</xs:template>

