This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Comparison operator


Jean.Ossmann@zas.admin.ch wrote:
> Hi, I am a little bit lost and couldn't find in a reasonnable time in the
> references why does the following test return true with  <mytag> -1
> </mytag>
> 
> <xsl:if test="./mytag[. &gt; '0']">

The problem is not the operator but the fact that '0' is a string. If
you want to compare them as numbers, remove the quotes from the zero.
Also, the "./" is unnecessary/implied. Finally, the way you wrote it,
if you remove the quotes, you'll get the results you want, but

  <xsl:if test="mytag &gt; 0">

is probably easier and has the same result. If there's a chance that
there's more than one mytag child, you might want to change that to 
mytag[1] to only look at the first one.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]