|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Comparing two variables
> <!-- 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








