|
Subject: [xsl] Comparing two variables From: Lucas Brasilino <brasilino@xxxxxxxxxxxxxxxx> Date: Thu, 29 Apr 2004 09:08:07 -0300 |
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 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?
<!-- 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>[]'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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Create personal functions, Michael Kay | Thread | RE: [xsl] Comparing two variables, Michael Kay |
| RE: AW: AW: AW: AW: [xsl] tomcat we, Daniel Joshua | Date | [xsl] Add attribute to all node, Animesh Sharma |
| Month |