|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Comparing two variables
Hi Folks:
I've been looking the archives but didn't found any thread about it. I've also checked Dave's FAQ. I'm writing a stylesheet to generate presentations in HTML. I've wrote two named templates called "find.nextslide" and "find.lastslide" to generate a link to those slides (that appears on top left of present slide). My problem is who can I compare the $next variable, which is the position of actual "<slide>" element plus 1, and $last variable. If $next > $last so $result = $last else $result = $next. I've tried many "test" attribute of <xsl:when> element, like: test="$next > $last" I was not really sure if $next and $last were number value or string, so I tried: test="number($next) > number($last)" test="$next > number($last)" My XSLT processor, xsltproc (v. 1.1.3), complains: xmlXPathCompOpEval: parameter error runtime error: file xpresent-common.xsl line 98 element value-of xsltValueOf: text copy failed line 98 is:
<xsl:value-of select="concat('slide',$result,'.html')"/>
of "find.nextslide" named template.Am I messing things up? I really can't figure out... Any ideas? here goes both templates: <!-- 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>thanks a lot in advance!!! -- []'s Lucas Brasilino brasilino@xxxxxxxxxxxxxxxx http://www.recife.pe.gov.br Emprel - Empresa Municipal de Informatica (pt_BR) Municipal Computing Enterprise (en_US) Recife - Pernambuco - Brasil Fone: +55-81-34167078
|
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








