[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Comparing two variables

Subject: Comparing two variables
From: Lucas Brasilino <brasilino@xxxxxxxxxxxxxxxx>
Date: Thu, 29 Apr 2004 09:08:07 -0300
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) &gt; number($last)"
test="$next &gt; 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 &gt; $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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.