I have xslt/xpath v1.0 stack under .NET.
I want to set a variable $myVar
conditionally:
<xsl:variable name="myVar">
<xsl:if test="$case ='1'">
<xsl:copy-of select="$otherVarA/down/the/rabbit/hole"/>
</xsl:if>
<xsl:if test="$case ='2'">
<xsl:copy-of select="$otherVarB/down/the/rabbit/hole"/>
</xsl:if>
<xsl:if test="$case ='3'">
<xsl:copy-of select="$otherVarC/down/the/rabbit/hole"/>
</xsl:if>
</xsl:variable>
Later on there are downward accesses: $myVar/go/deeper
but also upward accesses like so $myVar/ancestor::rabbit
.
Obviously <xsl:copy-of select="$myVar/down/to/rabbit/hole"/>
cuts the path upwards.
How can i set $myVar
way in order to access the ancestor axis?
I know that <xsl:variable name=... select=...
does not cut upward axis.