<!-- returns the last slide number -->
<xsl:template name="find.lastslide">
<xsl:value-of select="count(/xpresent/slide)"/>
</xsl:template>
<!-- creates an "slideX.html" string -->
<xsl:template name="find.nextslide">
<xsl:variable name="next" select="position() + 1"/>
<xsl:variable name="last"><xsl:call-template
name="find.lastslide"/></xsl:variable>
<xsl:choose>
<xsl:when test="$next > $last">
<xsl:variable name="result"><xsl:value-of
select="$last"/></xsl:variable>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="result"><xsl:value-of
select="$next"/></xsl:variable>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="concat('slide',$result,'.html')"/>
</xsl:template>
You should get a compile-time error saying that the $result variable is not
in scope at the point where you use it.
Complain to your XSLT processor vendor (or switch to a different processor),
and change your code to:
<xsl:variable name="result">
<xsl:choose>
<xsl:when test="$next > $last">
<xsl:value-of select="$last"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$next"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat('slide',$result,'.html')"/>
Michael Kay