|
Subject: RE: [xsl] Comparing two variables From: "Michael Kay" <mhk@xxxxxxxxx> Date: Thu, 29 Apr 2004 14:19:01 +0100 |
> <!-- 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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Comparing two variables, Lucas Brasilino | Thread | Re: [xsl] Comparing two variables, David Carlisle |
| RE: [xsl] Create personal functions, Kenny Akridge | Date | RE: [xsl] Using XPath to retrieve n, Kenny Akridge |
| Month |