When I try to use the code below I get a duplicate variable error because variables are immutable. How do I set the smaller of the two variables ($nextSubPartPos and $nextQuestionStemPos) as my new variable ($nextQuestionPos)?
<xsl:variable name='nextQuestionPos'/> <xsl:choose> <xsl:when test='$nextSubPartPos < $nextQuestionStemPos'> <xsl:variable name='nextQuestionPos' select='$nextSubPartPos'/> </xsl:when> <xsl:otherwise> <xsl:variable name='nextQuestionPos' select='$nextSubPartPos'/> </xsl:otherwise> </xsl:choose>
Don’t close the xsl:variable node in the first line. That is, take the / out of it, then put an
</xsl:variable>after</xsl:choose>. Next, change the<xsl:variable>nodes inside the choose to<xsl:value-of>nodes.That is, you want to set the value of the variable with the choose. There are two ways to set the value of a variable. One is the select attribute, the other is the inner text of the node.