#1
  1. a lazy guy
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Hong Kong
    Posts
    99
    Rep Power
    14

    XSLT problem: numeric comparison


    Hello,

    I got a problem on getting the numeric comparison work in my XSL.

    here is my code:
    Code:
    <xsl:variable name="FirstRec">
     <xsl:for-each select="./Results/Result">
        <xsl:if test="position() = 1">
           <xsl:value-of select="./RecNo"/>
        </xsl:if>
       </xsl:for-each>
    </xsl:variable>
    <xsl:if test="$FirstRec > ./RecPerPage">
      ... do something here ...
    </xsl:if>
    when $FirstRec is 50, and ./RecPerPage is 10, its work.
    but when $FirstRec is 101, and ./RecPerPage is 50, the 'test' "$FirstRec > ./RecPerPage" doesnt work.

    Any idea?

    Thanks
  2. #2
  3. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    Your variable is being evaluated as a string, and "5" is bigger than "1", just like "b" is bigger than "a". Try number($FirstRec) > number(./RecPerPage)

IMN logo majestic logo threadwatch logo seochat tools logo