Thank you folks. In addition to getting the answers, I will also get the newer
ways/standards of implementing a solution!
----- Original Message ----
From: Sam Wilmott <sam(_at_)wilmott(_dot_)ca>
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Sent: Thu, October 7, 2010 10:26:16 PM
Subject: Re: [xsl] Less than symbol in xsl:if or xsl:when
On 2010-10-07, at 3:42 PM, sudheshna iyer wrote:
The following stmt works, but when I replace > with <, it doesn't work. I am
compiling with xmlspy with xslt1.0
<xsl:when test="string-length($VAR1) > $VAR2"> => Works
<xsl:when test="string-length($VAR1) < $VAR3"> => Doesn't work
My main goal is to check whether length of VAR2 is in between 2 numbers..
like
string-length($VAR1) >= $VAR2and string-length($VAR1) <= $VAR3
How do I achieve this?
If you're using XSLT 2.0 rather than XSLT 1.0, then a better way to do it is:
string-length($VAR1) ge $VAR2and string-length($VAR1) le $VAR3
XSLT 2.0 introduced the scalar operators eq, ne, lt, gt, le and ge, which
compare single values rather than lists, which is what XSLT 1.0 comparison
operators do. They are therefore safer to use when you're comparing single
values and they don't run into syntactic difficulties.
Sam.
------------
Sam Wilmott
sam(_at_)wilmott(_dot_)ca
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--