What can I do to make this code work?
<xsl:choose>
<xsl:when test='type = 6'>
<xsl:variable name='title' select='root/info/title' />
</xsl:when>
<xsl:when test='type = 7'>
<xsl:variable name='title' select='root/name' />
</xsl:when>
<xsl:otherwise>
<xsl:variable name='title'>unknown</xsl:variable>
</xsl:otherwise>
</xsl:choose>
<div class='title'>
<xsl:value-of select='$title'/>
</div>
This doesn't work because when i do <xsl:value-of select='$title'/>
, $title
is out of scope. I tried to add the line <xsl:variable name='title'/>
outside of the scope, but that won't work either, because then when i call <xsl:variable name='title' select='root/info/title' />
for example, i already have set this variable before. How should I solve this?