Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How check which variable is greater in xsl?

Tags:

xslt

   <xsl:variable name="a">20</xsl:variable>
    <xsl:variable name="b">10</xsl:variable>

      <xsl:if test="($a) > ($b)">
        ------
  </xsl:if>

I getting error in the if condion..

like image 679
user475464 Avatar asked Feb 01 '12 14:02

user475464


People also ask

How do you use greater than in XSLT?

Also, in XSLT 2.0, you can use the operators "gt" (greater than), "lt" (less than), and "eq" (equal).

How do you get the value of a variable in XSLT?

The XSLT <xsl:value-of> element is used to extract a value from an expression defined in the select attribute. The expression defined in the mandatory select attribute is either an XPATH expression (for nodes and/or values) or a variable reference. The return of the <xsl:value-of> function is a literal value.

How do you write less than in XSLT?

You're always safe using &gt; here, although some XSLT processors process the greater-than sign correctly if you use > instead. If you need to use the less-than operator ( < ), you'll have to use the &lt; entity.


1 Answers

Try the following :

 <xsl:if test="$a &gt; $b">

Try using the character entities for > (&gt;) and < (&lt;) operators in expressions, otherwise some parsers think you are closing the tag early, or opening another.

like image 178
Goran Mottram Avatar answered Sep 22 '22 01:09

Goran Mottram